├── .gitignore ├── .gitmodules ├── LICENSE ├── OpenSource2-SDK ├── .editorconfig ├── OpenSource2-SDK.sln ├── OpenSource2-SDK.vcxproj ├── OpenSource2-SDK.vcxproj.filters ├── OpenSource2-SDK.vcxproj.user ├── cpp.hint ├── dependencies │ └── funchook │ │ ├── include │ │ ├── distorm.h │ │ ├── distormx.lib │ │ └── mnemonics.h │ │ └── src │ │ ├── config.h │ │ ├── decoder.c │ │ ├── decoder.h │ │ ├── disasm.h │ │ ├── disasm_distorm.c │ │ ├── distorm.c │ │ ├── funchook.c │ │ ├── funchook.h │ │ ├── funchook_internal.h │ │ ├── funchook_windows.c │ │ ├── funchook_x86.c │ │ ├── funchook_x86.h │ │ ├── instructions.c │ │ ├── instructions.h │ │ ├── insts.c │ │ ├── insts.h │ │ ├── mnemonics.c │ │ ├── operands.c │ │ ├── operands.h │ │ ├── prefix.c │ │ ├── prefix.h │ │ ├── textdefs.c │ │ ├── textdefs.h │ │ ├── wstring.h │ │ └── x86defs.h ├── resources │ └── fonts │ │ ├── cartograph_font.hpp │ │ ├── icons │ │ ├── IconsMaterialDesignIcons.h │ │ └── mdi_font.hpp │ │ ├── libertad_font.hpp │ │ └── red_hat_display.hpp └── src │ ├── entrypoint │ ├── OpenSource2SDK.cpp │ ├── OpenSource2SDK.hpp │ └── dllmain.cpp │ ├── features │ ├── aim_enhancement │ │ ├── aimbot.cpp │ │ ├── aimbot.hpp │ │ ├── recoil_control.cpp │ │ └── recoil_control.hpp │ ├── drawing │ │ ├── drawing.cpp │ │ └── drawing.hpp │ ├── esp │ │ ├── esp.cpp │ │ └── esp.hpp │ ├── feature.hpp │ ├── features.cpp │ ├── features.hpp │ ├── fov_changer │ │ ├── fov_changer.cpp │ │ └── fov_changer.hpp │ ├── game_hooks │ │ ├── game_hooks.cpp │ │ └── game_hooks.hpp │ ├── helpers │ │ ├── draw_utilities.cpp │ │ ├── draw_utilities.hpp │ │ ├── post_processing.cpp │ │ └── post_processing.hpp │ ├── movement │ │ ├── bunnyhop.cpp │ │ └── bunnyhop.hpp │ └── triggerbot │ │ ├── triggerbot.cpp │ │ └── triggerbot.hpp │ ├── game │ ├── renderer.cpp │ └── state.hpp │ ├── gamedata │ ├── gamedata.cpp │ └── gamedata.hpp │ ├── menu │ ├── components │ │ └── TopBar.cpp │ ├── gui │ │ ├── gui.cpp │ │ └── gui.hpp │ ├── menu.cpp │ ├── menu.hpp │ └── state.hpp │ └── sdk │ ├── api.hpp │ ├── fnv1a │ └── hash_fnv1a_constexpr.hpp │ ├── framework.hpp │ ├── hooks │ ├── directx11 │ │ ├── directx11_hook.cpp │ │ └── directx11_hook.hpp │ ├── hook.hpp │ ├── hooks.cpp │ ├── hooks.hpp │ └── wndproc │ │ ├── wndproc_hook.cpp │ │ └── wndproc_hook.hpp │ ├── interface │ └── interface.hpp │ ├── interfaces │ ├── interfaces.cpp │ └── interfaces.hpp │ ├── math │ ├── classes │ │ ├── transform.cpp │ │ ├── transform.hpp │ │ ├── vector.hpp │ │ └── vmatrix.hpp │ ├── math.cpp │ ├── math.hpp │ └── types │ │ ├── bbox_t.hpp │ │ └── quaternion.hpp │ ├── memory │ ├── memory.cpp │ └── memory.hpp │ ├── module │ └── module.hpp │ ├── schema │ ├── schema.cpp │ └── schema.hpp │ ├── shaders │ ├── CopyPS.hlsl │ ├── build │ │ └── gaussian_blur.hpp │ ├── gaussian_blur_x.hlsl │ └── gaussian_blur_y.hlsl │ ├── source-sdk │ ├── classes │ │ ├── bitflag.hpp │ │ ├── c_attributecontainer.hpp │ │ ├── c_baseplayerweapon.hpp │ │ ├── ccsgoinput.hpp │ │ ├── cgameentitysystem.cpp │ │ ├── cgameentitysystem.hpp │ │ ├── cgameevent.hpp │ │ ├── cgameeventmanager.hpp │ │ ├── chandle.cpp │ │ ├── chandle.hpp │ │ ├── cheapmemalloc.hpp │ │ ├── cmaterial2.hpp │ │ ├── cnetworkutlvectorbase.hpp │ │ ├── cstronghandle.hpp │ │ ├── cutlmap.hpp │ │ ├── cutlsymbollarge.hpp │ │ ├── cutlvector.hpp │ │ ├── econ │ │ │ ├── c_econentity.hpp │ │ │ ├── c_econitemview.cpp │ │ │ ├── c_econitemview.hpp │ │ │ ├── ceconitem.cpp │ │ │ ├── ceconitem.hpp │ │ │ ├── ceconitemdefinition.cpp │ │ │ ├── ceconitemdefinition.hpp │ │ │ ├── ceconitemschema.cpp │ │ │ ├── ceconitemschema.hpp │ │ │ └── ceconitemsystem.hpp │ │ ├── entity │ │ │ ├── bones │ │ │ │ ├── cbonesystem.cpp │ │ │ │ └── cbonesystem.hpp │ │ │ ├── c_baseentity.cpp │ │ │ ├── c_baseentity.hpp │ │ │ ├── c_basemodelentity.cpp │ │ │ ├── c_basemodelentity.hpp │ │ │ ├── c_baseplayerpawn.hpp │ │ │ ├── c_baseplayerweapon.hpp │ │ │ ├── c_baseviewmodel.hpp │ │ │ ├── c_chicken.hpp │ │ │ ├── c_csplayerpawn.cpp │ │ │ ├── c_csplayerpawn.hpp │ │ │ ├── c_csplayerpawnbase.hpp │ │ │ ├── c_csweaponbase.cpp │ │ │ ├── c_csweaponbase.hpp │ │ │ ├── c_plantedc4.hpp │ │ │ ├── c_pointcamera.hpp │ │ │ ├── cbaseplayercontroller.hpp │ │ │ ├── ccollisionproperty.hpp │ │ │ ├── ccsplayer_viewmodelservices.hpp │ │ │ ├── ccsplayercontroller.hpp │ │ │ ├── centityidentity.hpp │ │ │ ├── centityinstance.hpp │ │ │ ├── cgamescenenode.cpp │ │ │ ├── cgamescenenode.hpp │ │ │ ├── cplayer_cameraservices.hpp │ │ │ ├── cplayer_weaponservices.hpp │ │ │ └── hitbox │ │ │ │ └── hitbox.hpp │ │ ├── gcsdk │ │ │ ├── cgcclient.cpp │ │ │ ├── cgcclient.hpp │ │ │ ├── cgcclientsystem.cpp │ │ │ └── cgcclientsystem.hpp │ │ ├── material_system │ │ │ └── material_system.hpp │ │ └── types │ │ │ ├── c_sounddata.hpp │ │ │ ├── c_trace.cpp │ │ │ ├── c_trace.hpp │ │ │ └── cglobalvarsbase.hpp │ ├── interfaces │ │ ├── ccvar.hpp │ │ ├── cengineclient.hpp │ │ ├── cgameeventmanager.hpp │ │ ├── cgameresourceserviceclient.hpp │ │ ├── cinputsystem.hpp │ │ ├── clocalize.hpp │ │ ├── cmaterialsystem2.hpp │ │ ├── cschemasystem.hpp │ │ ├── csource2client.hpp │ │ └── iscenelayer.hpp │ └── source-sdk.hpp │ ├── utilities │ └── static_string.hpp │ └── virtual │ └── virtual.hpp ├── README.md └── media ├── gui-v0.2.0.png ├── gui-v0.3.0.png ├── gui-v0.4.0.png ├── gui-v0.5.0-1.png └── gui-v0.5.0-2.png /.gitignore: -------------------------------------------------------------------------------- 1 | x64/ 2 | .vs/ 3 | !.vs/settings.json -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "OpenSource2-SDK/dependencies/imgui"] 2 | path = OpenSource2-SDK/dependencies/imgui 3 | url = https://github.com/ocornut/imgui.git 4 | [submodule "OpenSource2-SDK/dependencies/stb"] 5 | path = OpenSource2-SDK/dependencies/stb 6 | url = https://github.com/cristeigabriel/STB.git 7 | [submodule "OpenSource2-SDK/dependencies/implot"] 8 | path = OpenSource2-SDK/dependencies/implot 9 | url = https://github.com/epezent/implot.git 10 | [submodule "OpenSource2-SDK/dependencies/glm"] 11 | path = OpenSource2-SDK/dependencies/glm 12 | url = https://github.com/g-truc/glm.git 13 | [submodule "OpenSource2-SDK/dependencies/nlohmann"] 14 | path = OpenSource2-SDK/dependencies/nlohmann 15 | url = https://github.com/nlohmann/json.git 16 | branch = develop 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 alza54 (18yo) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OpenSource2-SDK/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | end_of_line = lf 10 | 11 | [Makefile] 12 | indent_style = tab 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /OpenSource2-SDK/OpenSource2-SDK.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33424.131 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenSource2-SDK", "OpenSource2-SDK.vcxproj", "{00E72344-CA6E-47D4-B151-486E3E586950}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {00E72344-CA6E-47D4-B151-486E3E586950}.Debug|x64.ActiveCfg = Debug|x64 15 | {00E72344-CA6E-47D4-B151-486E3E586950}.Debug|x64.Build.0 = Debug|x64 16 | {00E72344-CA6E-47D4-B151-486E3E586950}.Release|x64.ActiveCfg = Release|x64 17 | {00E72344-CA6E-47D4-B151-486E3E586950}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {DEC8475C-586D-4369-B6D3-0EA29A48154D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /OpenSource2-SDK/OpenSource2-SDK.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /OpenSource2-SDK/cpp.hint: -------------------------------------------------------------------------------- 1 | // Hint files help the Visual Studio IDE interpret Visual C++ identifiers 2 | // such as names of functions and macros. 3 | // For more information see https://go.microsoft.com/fwlink/?linkid=865984 4 | #define CONFIG_GETTER(TYPE, NAME) TYPE&##NAME() { return config_.NAME; } 5 | #define CONSTRUCT_FEATURE(FEATURE_NAME) FEATURE_NAME(Features* pFeatures_) : Feature(#FEATURE_NAME, pFeatures_) 6 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/include/distormx.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alza54/opensource2/ff7c27a072f059597277b2eeacaf012683d4ff74/OpenSource2-SDK/dependencies/funchook/include/distormx.lib -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | config.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef CONFIG_H 12 | #define CONFIG_H 13 | 14 | /* diStorm version number. */ 15 | #define __DISTORMV__ 0x030503 16 | 17 | #include /* memset, memcpy - can be easily self implemented for libc independency. */ 18 | 19 | #include "../include/distorm.h" 20 | 21 | /* 22 | * 64 bit offsets support: 23 | * This macro should be defined from compiler command line flags, e.g: 24 | * -DSUPPORT_64BIT_OFFSET Note: make sure that the caller (library user) defines 25 | * it too! 26 | */ 27 | /* #define SUPPORT_64BIT_OFFSET */ 28 | 29 | /* 30 | * If you compile diStorm as a dynamic library (.dll or .so) file, make sure you 31 | * uncomment the next line. So the interface functions will be exported, 32 | * otherwise they are useable only for static library. For example, this macro 33 | * is being set for compiling diStorm as a .dll for Python with CTypes. 34 | */ 35 | /* #define DISTORM_DYNAMIC */ 36 | 37 | /* 38 | * If DISTORM_LIGHT is defined, everything involved in formatting the 39 | * instructions as text will be excluded from compilation. distorm_decode(..) 40 | * and distorm_format(..) will not be available. This will decrease the size of 41 | * the executable and leave you with decomposition functionality only. 42 | * 43 | * Note: it should be either set in the preprocessor definitions manually or in 44 | * command line -D switch. #define DISTORM_LIGHT 45 | */ 46 | 47 | /* 48 | * diStorm now supports little/big endian CPU's. 49 | * It should detect the endianness according to predefined macro's of the 50 | * compiler. If you don't use GCC/MSVC you will have to define it on your own. 51 | */ 52 | 53 | /* These macros are used in order to make the code portable. */ 54 | #ifdef __GNUC__ 55 | 56 | #include 57 | 58 | #define _DLLEXPORT_ 59 | #define _FASTCALL_ 60 | /* Keep inline as static (arrrrg) as it would break linux on some flavors 61 | * otherwise. */ 62 | #define _INLINE_ static 63 | /* GCC ignores this directive... */ 64 | /*#define _FASTCALL_ __attribute__((__fastcall__))*/ 65 | 66 | /* Set endianity (supposed to be LE though): */ 67 | #ifdef __BIG_ENDIAN__ 68 | #define BE_SYSTEM 69 | #endif 70 | 71 | /* End of __GCC__ */ 72 | 73 | #elif __WATCOMC__ 74 | 75 | #include 76 | 77 | #define _DLLEXPORT_ 78 | #define _FASTCALL_ 79 | #define _INLINE_ __inline 80 | 81 | /* End of __WATCOMC__ */ 82 | 83 | #elif __DMC__ 84 | 85 | #include 86 | 87 | #define _DLLEXPORT_ 88 | #define _FASTCALL_ 89 | #define _INLINE_ __inline 90 | 91 | /* End of __DMC__ */ 92 | 93 | #elif __TINYC__ 94 | 95 | #include 96 | 97 | #define _DLLEXPORT_ 98 | #define _FASTCALL_ 99 | #define _INLINE_ static 100 | 101 | /* End of __TINYC__ */ 102 | 103 | #elif _MSC_VER 104 | 105 | /* stdint alternative is defined in distorm.h */ 106 | 107 | #define _DLLEXPORT_ __declspec(dllexport) 108 | #define _FASTCALL_ __fastcall 109 | #define _INLINE_ __inline 110 | 111 | /* Set endianity (supposed to be LE though): */ 112 | #if !defined(_M_IX86) && !defined(_M_X64) 113 | #define BE_SYSTEM 114 | #endif 115 | 116 | #endif /* #elif _MSC_VER */ 117 | 118 | /* If the library isn't compiled as a dynamic library don't export any 119 | * functions. */ 120 | #ifndef DISTORM_DYNAMIC 121 | #undef _DLLEXPORT_ 122 | #define _DLLEXPORT_ 123 | #endif 124 | 125 | #ifndef FALSE 126 | #define FALSE 0 127 | #endif 128 | #ifndef TRUE 129 | #define TRUE 1 130 | #endif 131 | 132 | /* Define stream read functions for big endian systems. */ 133 | #ifdef BE_SYSTEM 134 | 135 | /* Avoid defining 'static static' for GCC. */ 136 | #ifndef __GNUC__ 137 | #define STATIC_INLINE static _INLINE_ 138 | #else 139 | #define STATIC_INLINE static 140 | #endif 141 | 142 | /* 143 | * Assumption: These functions can read from the stream safely! 144 | * Swap endianity of input to little endian. 145 | */ 146 | STATIC_INLINE int16_t RSHORT(const uint8_t *s) { return s[0] | (s[1] << 8); } 147 | STATIC_INLINE uint16_t RUSHORT(const uint8_t *s) { return s[0] | (s[1] << 8); } 148 | STATIC_INLINE int32_t RLONG(const uint8_t *s) { 149 | return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24); 150 | } 151 | STATIC_INLINE uint32_t RULONG(const uint8_t *s) { 152 | return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24); 153 | } 154 | STATIC_INLINE int64_t RLLONG(const uint8_t *s) { 155 | return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24) | 156 | ((uint64_t)s[4] << 32) | ((uint64_t)s[5] << 40) | 157 | ((uint64_t)s[6] << 48) | ((uint64_t)s[7] << 56); 158 | } 159 | STATIC_INLINE uint64_t RULLONG(const uint8_t *s) { 160 | return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24) | 161 | ((uint64_t)s[4] << 32) | ((uint64_t)s[5] << 40) | 162 | ((uint64_t)s[6] << 48) | ((uint64_t)s[7] << 56); 163 | } 164 | 165 | #undef STATIC_INLINE 166 | 167 | #else 168 | /* Little endian macro's will just make the cast. */ 169 | #define RSHORT(x) *(int16_t *)x 170 | #define RUSHORT(x) *(uint16_t *)x 171 | #define RLONG(x) *(int32_t *)x 172 | #define RULONG(x) *(uint32_t *)x 173 | #define RLLONG(x) *(int64_t *)x 174 | #define RULLONG(x) *(uint64_t *)x 175 | #endif 176 | 177 | #endif /* CONFIG_H */ 178 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | decoder.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef DECODER_H 12 | #define DECODER_H 13 | 14 | #include "config.h" 15 | 16 | typedef unsigned int _iflags; 17 | 18 | _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, 19 | _DInst result[], unsigned int maxResultCount, 20 | unsigned int* usedInstructionsCount); 21 | 22 | #endif /* DECODER_H */ 23 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/disasm.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: nil -*- 2 | * 3 | * This file is part of Funchook. 4 | * https://github.com/kubo/funchook 5 | * 6 | * Funchook is free software: you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation, either version 2 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * As a special exception, the copyright holders of this library give you 12 | * permission to link this library with independent modules to produce an 13 | * executable, regardless of the license terms of these independent 14 | * modules, and to copy and distribute the resulting executable under 15 | * terms of your choice, provided that you also meet, for each linked 16 | * independent module, the terms and conditions of the license of that 17 | * module. An independent module is a module which is not derived from or 18 | * based on this library. If you modify this library, you may extend this 19 | * exception to your version of the library, but you are not obliged to 20 | * do so. If you do not wish to do so, delete this exception statement 21 | * from your version. 22 | * 23 | * Funchook is distributed in the hope that it will be useful, but WITHOUT 24 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26 | * for more details. 27 | * 28 | * You should have received a copy of the GNU General Public License 29 | * along with Funchook. If not, see . 30 | */ 31 | #ifndef DISASM_H 32 | #define DISASM_H 1 33 | 34 | #ifdef DISASM_DISTORM 35 | #include 36 | #include 37 | 38 | typedef struct funchook_disasm { 39 | funchook_t *funchook; 40 | _CodeInfo ci; 41 | unsigned int idx; 42 | unsigned int cnt; 43 | _DInst dis[MAX_INSN_CHECK_SIZE]; 44 | } funchook_disasm_t; 45 | typedef _DInst funchook_insn_t; 46 | 47 | #define funchook_insn_size(insn) ((insn)->size) 48 | #define funchook_insn_address(insn) ((size_t)(insn)->addr) 49 | #define funchook_insn_branch_address(insn) ((size_t)INSTRUCTION_GET_TARGET(insn)) 50 | 51 | #endif 52 | 53 | #ifdef DISASM_CAPSTONE 54 | #include 55 | 56 | typedef struct funchook_disasm { 57 | funchook_t *funchook; 58 | csh handle; 59 | cs_insn *insns; 60 | size_t index; 61 | size_t count; 62 | } funchook_disasm_t; 63 | 64 | typedef cs_insn funchook_insn_t; 65 | 66 | #define funchook_insn_size(insn) ((insn)->size / sizeof(insn_t)) 67 | #define funchook_insn_address(insn) ((size_t)(insn)->address) 68 | #define funchook_insn_branch_address(insn) ((size_t)(insn)->detail->x86.operands[0].imm) 69 | #endif 70 | 71 | #ifdef DISASM_ZYDIS 72 | #include 73 | 74 | typedef struct { 75 | ZydisDecodedInstruction insn; 76 | size_t next_address; 77 | } funchook_insn_t; 78 | 79 | typedef struct funchook_disasm { 80 | funchook_t *funchook; 81 | ZydisDecoder decoder; 82 | ZydisFormatter formatter; 83 | funchook_insn_t insn; 84 | const uint8_t *code; 85 | const uint8_t *code_end; 86 | } funchook_disasm_t; 87 | 88 | #define funchook_insn_size(insn) ((insn)->insn.length) 89 | #define funchook_insn_address(insn) ((insn)->next_address - (insn)->insn.length) 90 | #define funchook_insn_branch_address(insn) ((insn)->next_address + (intptr_t)(insn)->insn.raw.imm[0].value.s) 91 | 92 | #endif 93 | 94 | #define FUNCHOOK_ERROR_END_OF_INSTRUCTION -2 95 | 96 | int funchook_disasm_init(funchook_disasm_t *disasm, funchook_t *funchook, const insn_t *code, size_t code_size, size_t address); 97 | void funchook_disasm_cleanup(funchook_disasm_t *disasm); 98 | int funchook_disasm_next(funchook_disasm_t *disasm, const funchook_insn_t **next_insn); 99 | void funchook_disasm_log_instruction(funchook_disasm_t *disasm, const funchook_insn_t *insn); 100 | 101 | #if defined(CPU_ARM64) 102 | funchook_insn_info_t funchook_disasm_arm64_insn_info(funchook_disasm_t *disasm, const funchook_insn_t *insn); 103 | #endif 104 | 105 | #if defined(CPU_X86) || defined(CPU_X86_64) 106 | /* RIP-relative address information */ 107 | typedef struct { 108 | insn_t *addr; /* absolute address */ 109 | intptr_t raddr; /* relative address */ 110 | int offset; 111 | int size; 112 | } rip_relative_t; 113 | 114 | void funchook_disasm_x86_rip_relative(funchook_disasm_t *disasm, const funchook_insn_t *insn, rip_relative_t *rel_disp, rip_relative_t *rel_imm); 115 | #endif 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/funchook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Funchook. 3 | * https://github.com/kubo/funchook 4 | * 5 | * Funchook is free software: you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License as published by the 7 | * Free Software Foundation, either version 2 of the License, or (at your 8 | * option) any later version. 9 | * 10 | * As a special exception, the copyright holders of this library give you 11 | * permission to link this library with independent modules to produce an 12 | * executable, regardless of the license terms of these independent 13 | * modules, and to copy and distribute the resulting executable under 14 | * terms of your choice, provided that you also meet, for each linked 15 | * independent module, the terms and conditions of the license of that 16 | * module. An independent module is a module which is not derived from or 17 | * based on this library. If you modify this library, you may extend this 18 | * exception to your version of the library, but you are not obliged to 19 | * do so. If you do not wish to do so, delete this exception statement 20 | * from your version. 21 | * 22 | * Funchook is distributed in the hope that it will be useful, but WITHOUT 23 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25 | * for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with Funchook. If not, see . 29 | */ 30 | #ifndef FUNCHOOK_H 31 | #define FUNCHOOK_H 1 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* 38 | * Only functions with FUNCHOOK_EXPORT are visible from outside of funchook.dll 39 | * or libfunchook.so. Others are invisible. 40 | */ 41 | #ifdef FUNCHOOK_EXPORTS 42 | #if defined(_WIN32) 43 | #define FUNCHOOK_EXPORT __declspec(dllexport) 44 | #elif defined(__GNUC__) 45 | #define FUNCHOOK_EXPORT __attribute__((visibility("default"))) 46 | #endif 47 | #endif /* FUNCHOOK_EXPORTS */ 48 | #ifndef FUNCHOOK_EXPORT 49 | #define FUNCHOOK_EXPORT 50 | #endif 51 | 52 | typedef struct funchook funchook_t; 53 | 54 | #define FUNCHOOK_ERROR_INTERNAL_ERROR -1 55 | #define FUNCHOOK_ERROR_SUCCESS 0 56 | #define FUNCHOOK_ERROR_OUT_OF_MEMORY 1 57 | #define FUNCHOOK_ERROR_ALREADY_INSTALLED 2 58 | #define FUNCHOOK_ERROR_DISASSEMBLY 3 59 | #define FUNCHOOK_ERROR_IP_RELATIVE_OFFSET 4 60 | #define FUNCHOOK_ERROR_CANNOT_FIX_IP_RELATIVE 5 61 | #define FUNCHOOK_ERROR_FOUND_BACK_JUMP 6 62 | #define FUNCHOOK_ERROR_TOO_SHORT_INSTRUCTIONS 7 63 | #define FUNCHOOK_ERROR_MEMORY_ALLOCATION 8 /* memory allocation error */ 64 | #define FUNCHOOK_ERROR_MEMORY_FUNCTION 9 /* other memory function errors */ 65 | #define FUNCHOOK_ERROR_NOT_INSTALLED 10 66 | #define FUNCHOOK_ERROR_NO_AVAILABLE_REGISTERS 11 67 | 68 | /** 69 | * Create a funchook handle 70 | * 71 | * @return allocated funchook handle. NULL when out-of-memory. 72 | */ 73 | FUNCHOOK_EXPORT funchook_t *funchook_create(void); 74 | 75 | /** 76 | * Prepare hooking 77 | * 78 | * @param funchook a funchook handle created by funchook_create() 79 | * @param target_func function pointer to be intercepted. The pointer to trampoline function is set on success. 80 | * @param hook_func function pointer which is called istead of target_func 81 | * @return error code. one of FUNCHOOK_ERROR_*. 82 | */ 83 | FUNCHOOK_EXPORT int funchook_prepare(funchook_t *funchook, void **target_func, void *hook_func); 84 | 85 | /** 86 | * Install hooks prepared by funchook_prepare(). 87 | * 88 | * @param funchook a funchook handle created by funchook_create() 89 | * @param flags reserved. Set zero. 90 | * @return error code. one of FUNCHOOK_ERROR_*. 91 | */ 92 | FUNCHOOK_EXPORT int funchook_install(funchook_t *funchook, int flags); 93 | 94 | /** 95 | * Uninstall hooks installed by funchook_install(). 96 | * 97 | * @param funchook a funchook handle created by funchook_create() 98 | * @param flags reserved. Set zero. 99 | * @return error code. one of FUNCHOOK_ERROR_*. 100 | */ 101 | FUNCHOOK_EXPORT int funchook_uninstall(funchook_t *funchook, int flags); 102 | 103 | /** 104 | * Destroy a funchook handle 105 | * 106 | * @param funchook a funchook handle created by funchook_create() 107 | * @return error code. one of FUNCHOOK_ERROR_*. 108 | */ 109 | FUNCHOOK_EXPORT int funchook_destroy(funchook_t *funchook); 110 | 111 | /** 112 | * Get error message 113 | * 114 | * @param funchook a funchook handle created by funchook_create() 115 | * @return pointer to buffer containing error message 116 | */ 117 | FUNCHOOK_EXPORT const char *funchook_error_message(const funchook_t *funchook); 118 | 119 | /** 120 | * Set log file name to debug funchook itself. 121 | * 122 | * @param name log file name 123 | * @return error code. one of FUNCHOOK_ERROR_*. 124 | */ 125 | FUNCHOOK_EXPORT int funchook_set_debug_file(const char *name); 126 | 127 | #ifdef __cplusplus 128 | } // extern "C" 129 | #endif 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/funchook_x86.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: nil -*- 2 | * 3 | * This file is part of Funchook. 4 | * https://github.com/kubo/funchook 5 | * 6 | * Funchook is free software: you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation, either version 2 of the License, or (at your 9 | * option) any later version. 10 | * 11 | * As a special exception, the copyright holders of this library give you 12 | * permission to link this library with independent modules to produce an 13 | * executable, regardless of the license terms of these independent 14 | * modules, and to copy and distribute the resulting executable under 15 | * terms of your choice, provided that you also meet, for each linked 16 | * independent module, the terms and conditions of the license of that 17 | * module. An independent module is a module which is not derived from or 18 | * based on this library. If you modify this library, you may extend this 19 | * exception to your version of the library, but you are not obliged to 20 | * do so. If you do not wish to do so, delete this exception statement 21 | * from your version. 22 | * 23 | * Funchook is distributed in the hope that it will be useful, but WITHOUT 24 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26 | * for more details. 27 | * 28 | * You should have received a copy of the GNU General Public License 29 | * along with Funchook. If not, see . 30 | */ 31 | #ifndef FUNCHOOK_X86_H 32 | #define FUNCHOOK_X86_H 1 33 | 34 | #define MAX_INSN_LEN 16 35 | #define MAX_INSN_CHECK_SIZE 256 36 | 37 | #define JUMP32_SIZE 5 38 | #ifdef CPU_X86_64 39 | #define JUMP64_SIZE 14 40 | #endif 41 | 42 | #define TRAMPOLINE_SIZE (JUMP32_SIZE + (MAX_INSN_LEN - 1) + JUMP32_SIZE) 43 | 44 | typedef uint8_t insn_t; 45 | 46 | typedef struct funchook_entry { 47 | void *target_func; 48 | void *hook_func; 49 | uint8_t trampoline[TRAMPOLINE_SIZE]; 50 | uint8_t old_code[JUMP32_SIZE]; 51 | uint8_t new_code[JUMP32_SIZE]; 52 | #ifdef CPU_X86_64 53 | uint8_t transit[JUMP64_SIZE]; 54 | #endif 55 | } funchook_entry_t; 56 | 57 | typedef struct { 58 | const insn_t *dst_addr; 59 | intptr_t src_addr_offset; 60 | intptr_t pos_offset; 61 | } ip_displacement_entry_t; 62 | 63 | typedef struct { 64 | ip_displacement_entry_t disp[2]; 65 | } ip_displacement_t; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/insts.c: -------------------------------------------------------------------------------- 1 | /* 2 | insts.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef INSTS_H 12 | #define INSTS_H 13 | 14 | #include "instructions.h" 15 | 16 | /* Flags Table */ 17 | extern _iflags FlagsTable[]; 18 | 19 | /* Root Trie DB */ 20 | extern _InstSharedInfo InstSharedInfoTable[]; 21 | extern _InstInfo InstInfos[]; 22 | extern _InstInfoEx InstInfosEx[]; 23 | extern _InstNode InstructionsTree[]; 24 | 25 | /* 3DNow! Trie DB */ 26 | extern _InstNode Table_0F_0F; 27 | /* AVX related: */ 28 | extern _InstNode Table_0F, Table_0F_38, Table_0F_3A; 29 | 30 | /* 31 | * The inst_lookup will return on of these two instructions according to the 32 | * specified decoding mode. ARPL or MOVSXD on 64 bits is one byte instruction at 33 | * index 0x63. 34 | */ 35 | extern _InstInfo II_MOVSXD; 36 | 37 | /* 38 | * The NOP instruction can be prefixed by REX in 64bits, therefore we have to 39 | * decide in runtime whether it's an XCHG or NOP instruction. If 0x90 is 40 | * prefixed by a usable REX it will become XCHG, otherwise it will become a NOP. 41 | * Also note that if it's prefixed by 0xf3, it becomes a Pause. 42 | */ 43 | extern _InstInfo II_NOP; 44 | extern _InstInfo II_PAUSE; 45 | 46 | /* 47 | * RDRAND and VMPTRLD share same 2.3 bytes opcode, and then alternates on the 48 | * MOD bits, RDRAND is OT_FULL_REG while VMPTRLD is OT_MEM, and there's no such 49 | * mixed type. So a hack into the inst_lookup was added for this decision, the 50 | * DB isn't flexible enough. :( 51 | */ 52 | extern _InstInfo II_RDRAND; 53 | 54 | /* 55 | * Used for letting the extract operand know the type of operands without 56 | * knowing the instruction itself yet, because of the way those instructions 57 | * work. See function instructions.c!inst_lookup_3dnow. 58 | */ 59 | extern _InstInfo II_3DNOW; 60 | 61 | /* Helper tables for pseudo compare mnemonics. */ 62 | extern uint16_t CmpMnemonicOffsets[8]; /* SSE */ 63 | extern uint16_t VCmpMnemonicOffsets[32]; /* AVX */ 64 | 65 | #endif /* INSTS_H */ 66 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/insts.h: -------------------------------------------------------------------------------- 1 | /* 2 | insts.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef INSTS_H 12 | #define INSTS_H 13 | 14 | #include "instructions.h" 15 | 16 | /* Flags Table */ 17 | extern _iflags FlagsTable[]; 18 | 19 | /* Root Trie DB */ 20 | extern _InstSharedInfo InstSharedInfoTable[]; 21 | extern _InstInfo InstInfos[]; 22 | extern _InstInfoEx InstInfosEx[]; 23 | extern _InstNode InstructionsTree[]; 24 | 25 | /* 3DNow! Trie DB */ 26 | extern _InstNode Table_0F_0F; 27 | /* AVX related: */ 28 | extern _InstNode Table_0F, Table_0F_38, Table_0F_3A; 29 | 30 | /* 31 | * The inst_lookup will return on of these two instructions according to the 32 | * specified decoding mode. ARPL or MOVSXD on 64 bits is one byte instruction at 33 | * index 0x63. 34 | */ 35 | extern _InstInfo II_MOVSXD; 36 | 37 | /* 38 | * The NOP instruction can be prefixed by REX in 64bits, therefore we have to 39 | * decide in runtime whether it's an XCHG or NOP instruction. If 0x90 is 40 | * prefixed by a usable REX it will become XCHG, otherwise it will become a NOP. 41 | * Also note that if it's prefixed by 0xf3, it becomes a Pause. 42 | */ 43 | extern _InstInfo II_NOP; 44 | extern _InstInfo II_PAUSE; 45 | 46 | /* 47 | * RDRAND and VMPTRLD share same 2.3 bytes opcode, and then alternates on the 48 | * MOD bits, RDRAND is OT_FULL_REG while VMPTRLD is OT_MEM, and there's no such 49 | * mixed type. So a hack into the inst_lookup was added for this decision, the 50 | * DB isn't flexible enough. :( 51 | */ 52 | extern _InstInfo II_RDRAND; 53 | 54 | /* 55 | * Used for letting the extract operand know the type of operands without 56 | * knowing the instruction itself yet, because of the way those instructions 57 | * work. See function instructions.c!inst_lookup_3dnow. 58 | */ 59 | extern _InstInfo II_3DNOW; 60 | 61 | /* Helper tables for pseudo compare mnemonics. */ 62 | extern uint16_t CmpMnemonicOffsets[8]; /* SSE */ 63 | extern uint16_t VCmpMnemonicOffsets[32]; /* AVX */ 64 | 65 | #endif /* INSTS_H */ 66 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/operands.h: -------------------------------------------------------------------------------- 1 | /* 2 | operands.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef OPERANDS_H 12 | #define OPERANDS_H 13 | 14 | #include "config.h" 15 | #include "decoder.h" 16 | #include "instructions.h" 17 | #include "prefix.h" 18 | 19 | int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, 20 | _iflags instFlags, _OpType type, unsigned int modrm, 21 | _PrefixState* ps, _DecodeType effOpSz, 22 | _DecodeType effAdrSz, _Operand* op); 23 | 24 | #endif /* OPERANDS_H */ 25 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/prefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | prefix.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef PREFIX_H 12 | #define PREFIX_H 13 | 14 | #include "config.h" 15 | #include "decoder.h" 16 | 17 | /* Specifies the type of the extension prefix, such as: REX, 2 bytes VEX, 3 18 | * bytes VEX. */ 19 | typedef enum { 20 | PET_NONE = 0, 21 | PET_REX, 22 | PET_VEX2BYTES, 23 | PET_VEX3BYTES 24 | } _PrefixExtType; 25 | 26 | /* Specifies an index into a table of prefixes by their type. */ 27 | typedef enum { 28 | PFXIDX_NONE = -1, 29 | PFXIDX_REX, 30 | PFXIDX_LOREP, 31 | PFXIDX_SEG, 32 | PFXIDX_OP_SIZE, 33 | PFXIDX_ADRS, 34 | PFXIDX_MAX 35 | } _PrefixIndexer; 36 | 37 | /* 38 | * This holds the prefixes state for the current instruction we decode. 39 | * decodedPrefixes includes all specific prefixes that the instruction got. 40 | * start is a pointer to the first prefix to take into account. 41 | * last is a pointer to the last byte we scanned. 42 | * Other pointers are used to keep track of prefixes positions and help us know 43 | * if they appeared already and where. 44 | */ 45 | typedef struct { 46 | _iflags decodedPrefixes, usedPrefixes; 47 | /* Number of prefixes scanned for current instruction, including VEX! */ 48 | unsigned int count; 49 | uint16_t unusedPrefixesMask; 50 | /* Holds the offset to the prefix byte by its type. */ 51 | uint16_t pfxIndexer[PFXIDX_MAX]; 52 | _PrefixExtType prefixExtType; 53 | /* Indicates whether the operand size prefix (0x66) was used as a mandatory 54 | * prefix. */ 55 | int isOpSizeMandatory; 56 | /* If VEX prefix is used, store the VEX.vvvv field. */ 57 | unsigned int vexV; 58 | /* The fields B/X/R/W/L of REX and VEX are stored together in this byte. */ 59 | unsigned int vrex; 60 | const uint8_t* vexPos; 61 | } _PrefixState; 62 | 63 | /* 64 | * Intel supports 6 types of prefixes, whereas AMD supports 5 types (lock is 65 | * seperated from rep/nz). REX is the fifth prefix type, this time I'm based on 66 | * AMD64. VEX is the 6th, though it can't be repeated. 67 | */ 68 | #define MAX_PREFIXES (5) 69 | 70 | extern int PrefixTables[256 * 2]; 71 | 72 | _INLINE_ int prefixes_is_valid(unsigned char ch, _DecodeType dt) { 73 | /* The predicate selects (branchlessly) second half table for 64 bits 74 | * otherwise selects first half. */ 75 | return PrefixTables[ch + ((dt >> 1) << 8)]; 76 | } 77 | 78 | /* Ignore a specific prefix type. */ 79 | _INLINE_ void prefixes_ignore(_PrefixState* ps, _PrefixIndexer pi) { 80 | /* 81 | * If that type of prefix appeared already, set the bit of that *former* 82 | * prefix. Anyway, set the new index of that prefix type to the current index, 83 | * so next time we know its position. 84 | */ 85 | ps->unusedPrefixesMask |= ps->pfxIndexer[pi]; 86 | } 87 | 88 | void prefixes_ignore_all(_PrefixState* ps); 89 | uint16_t prefixes_set_unused_mask(_PrefixState* ps); 90 | void prefixes_decode(_CodeInfo* ci, _PrefixState* ps); 91 | void prefixes_use_segment(_iflags defaultSeg, _PrefixState* ps, _DecodeType dt, 92 | _DInst* di); 93 | 94 | #endif /* PREFIX_H */ 95 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/textdefs.c: -------------------------------------------------------------------------------- 1 | /* 2 | textdefs.c 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #include "textdefs.h" 12 | 13 | #ifndef DISTORM_LIGHT 14 | 15 | static uint8_t Nibble2ChrTable[16] = {'0', '1', '2', '3', '4', '5', '6', '7', 16 | '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; 17 | #define NIBBLE_TO_CHR Nibble2ChrTable[t] 18 | 19 | void str_hex(_WString* s, const uint8_t* buf, unsigned int len) { 20 | /* 256 * 2 : 2 chars per byte value. */ 21 | static const char* TextBTable = 22 | "000102030405060708090a0b0c0d0e0f" 23 | "101112131415161718191a1b1c1d1e1f" 24 | "202122232425262728292a2b2c2d2e2f" 25 | "303132333435363738393a3b3c3d3e3f" 26 | "404142434445464748494a4b4c4d4e4f" 27 | "505152535455565758595a5b5c5d5e5f" 28 | "606162636465666768696a6b6c6d6e6f" 29 | "707172737475767778797a7b7c7d7e7f" 30 | "808182838485868788898a8b8c8d8e8f" 31 | "909192939495969798999a9b9c9d9e9f" 32 | "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf" 33 | "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf" 34 | "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf" 35 | "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf" 36 | "e0e1e2e3e4e5e6e7e8e9eaebecedeeef" 37 | "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"; 38 | 39 | unsigned int i = 0; 40 | /* Length is at least 1, enter loop. */ 41 | s->length = len * 2; 42 | s->p[len * 2] = 0; 43 | do { 44 | RSHORT(&s->p[i]) = RSHORT(&TextBTable[(*buf) * 2]); 45 | buf++; 46 | i += 2; 47 | } while (i < len * 2); 48 | } 49 | 50 | #ifdef SUPPORT_64BIT_OFFSET 51 | 52 | void str_int_impl(unsigned char** s, uint64_t x) { 53 | int8_t* buf; 54 | int shift = 0; 55 | OFFSET_INTEGER t = x; 56 | 57 | buf = (int8_t*)*s; 58 | 59 | *buf++ = '0'; 60 | *buf++ = 'x'; 61 | 62 | if (x == 0) { 63 | *buf = '0'; 64 | *s += 3; 65 | return; 66 | } 67 | 68 | do { 69 | t >>= 4; 70 | shift += 4; 71 | } while (t); 72 | 73 | do { 74 | shift -= 4; 75 | t = (x >> shift) & 0xf; 76 | *buf++ = NIBBLE_TO_CHR; 77 | } while (shift > 0); 78 | 79 | *s = (unsigned char*)buf; 80 | } 81 | 82 | #else 83 | 84 | void str_int_impl(unsigned char** s, uint8_t src[8]) { 85 | int8_t* buf; 86 | int i = 0, shift = 0; 87 | uint32_t x = RULONG(&src[sizeof(int32_t)]); 88 | int t; 89 | 90 | buf = (int8_t*)*s; 91 | buf[0] = '0'; 92 | buf[1] = 'x'; 93 | buf += 2; 94 | 95 | for (shift = 28; shift != -4; shift -= 4) { 96 | t = (x >> shift) & 0xf; 97 | if (i | t) buf[i++] = NIBBLE_TO_CHR; 98 | } 99 | 100 | x = RULONG(src); 101 | for (shift = 28; shift != 0; shift -= 4) { 102 | t = (x >> shift) & 0xf; 103 | if (i | t) buf[i++] = NIBBLE_TO_CHR; 104 | } 105 | t = x & 0xf; 106 | buf[i++] = NIBBLE_TO_CHR; 107 | 108 | *s += (size_t)(i + 2); 109 | } 110 | 111 | #endif /* SUPPORT_64BIT_OFFSET */ 112 | 113 | #endif /* DISTORM_LIGHT */ 114 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/textdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | textdefs.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef TEXTDEFS_H 12 | #define TEXTDEFS_H 13 | 14 | #include "config.h" 15 | #include "wstring.h" 16 | 17 | #ifndef DISTORM_LIGHT 18 | 19 | #define PLUS_DISP_CHR '+' 20 | #define MINUS_DISP_CHR '-' 21 | #define OPEN_CHR '[' 22 | #define CLOSE_CHR ']' 23 | #define SP_CHR ' ' 24 | #define SEG_OFF_CHR ':' 25 | 26 | /* 27 | Naming Convention: 28 | 29 | * get - returns a pointer to a string. 30 | * str - concatenates to string. 31 | 32 | * hex - means the function is used for hex dump (number is padded to required 33 | size) - Little Endian output. 34 | * code - means the function is used for disassembled instruction - Big Endian 35 | output. 36 | * off - means the function is used for 64bit offset - Big Endian output. 37 | 38 | * h - '0x' in front of the string. 39 | 40 | * b - byte 41 | * dw - double word (can be used for word also) 42 | * qw - quad word 43 | 44 | * all numbers are in HEX. 45 | */ 46 | 47 | void str_hex(_WString* s, const uint8_t* buf, unsigned int len); 48 | 49 | #ifdef SUPPORT_64BIT_OFFSET 50 | #define str_int(s, x) str_int_impl((s), (x)) 51 | void str_int_impl(unsigned char** s, uint64_t x); 52 | #else 53 | #define str_int(s, x) str_int_impl((s), (uint8_t*)&(x)) 54 | void str_int_impl(unsigned char** s, uint8_t src[8]); 55 | #endif 56 | 57 | #endif /* DISTORM_LIGHT */ 58 | 59 | #endif /* TEXTDEFS_H */ 60 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/wstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | wstring.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef WSTRING_H 12 | #define WSTRING_H 13 | 14 | #include "../include/mnemonics.h" 15 | #include "config.h" 16 | 17 | #ifndef DISTORM_LIGHT 18 | 19 | _INLINE_ void strcat_WSR(unsigned char** str, const _WRegister* reg) { 20 | /* 21 | * Longest register name is YMM15 - 5 characters, 22 | * Copy 8 so compiler can do a QWORD move. 23 | * We copy nul termination and fix the length, so it's okay to copy more to 24 | * the output buffer. There's a sentinel register to make sure we don't read 25 | * past the end of the registers table. 26 | */ 27 | memcpy((int8_t*)*str, (const int8_t*)reg->p, 8); 28 | *str += reg->length; 29 | } 30 | 31 | #define strfinalize_WS(s, end) \ 32 | do { \ 33 | *end = 0; \ 34 | s.length = (unsigned int)((size_t)end - (size_t)s.p); \ 35 | } while (0) 36 | #define chrcat_WS(s, ch) \ 37 | do { \ 38 | *s = ch; \ 39 | s += 1; \ 40 | } while (0) 41 | #define strcat_WS(s, buf, copylen, advancelen) \ 42 | do { \ 43 | memcpy((int8_t*)s, buf, copylen); \ 44 | s += advancelen; \ 45 | } while (0) 46 | 47 | #endif /* DISTORM_LIGHT */ 48 | 49 | #endif /* WSTRING_H */ 50 | -------------------------------------------------------------------------------- /OpenSource2-SDK/dependencies/funchook/src/x86defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | x86defs.h 3 | 4 | diStorm3 - Powerful disassembler for X86/AMD64 5 | http://ragestorm.net/distorm/ 6 | distorm at gmail dot com 7 | Copyright (C) 2003-2021 Gil Dabah 8 | This library is licensed under the BSD license. See the file COPYING. 9 | */ 10 | 11 | #ifndef X86DEFS_H 12 | #define X86DEFS_H 13 | 14 | #define SEG_REGS_MAX (6) 15 | #define CREGS_MAX (9) 16 | #define DREGS_MAX (8) 17 | 18 | /* Maximum instruction size, including prefixes */ 19 | #define INST_MAXIMUM_SIZE (15) 20 | 21 | /* Maximum range of imm8 (comparison type) of special SSE CMP instructions. */ 22 | #define INST_CMP_MAX_RANGE (8) 23 | 24 | /* Maximum range of imm8 (comparison type) of special AVX VCMP instructions. */ 25 | #define INST_VCMP_MAX_RANGE (32) 26 | 27 | /* Wait instruction byte code. */ 28 | #define INST_WAIT_INDEX (0x9b) 29 | 30 | /* Lea instruction byte code. */ 31 | #define INST_LEA_INDEX (0x8d) 32 | 33 | /* NOP/XCHG instruction byte code. */ 34 | #define INST_NOP_INDEX (0x90) 35 | 36 | /* ARPL/MOVSXD instruction byte code. */ 37 | #define INST_ARPL_INDEX (0x63) 38 | 39 | /* 40 | * Minimal MODR/M value of divided instructions. 41 | * It's 0xc0, two MSBs set, which indicates a general purpose register is used 42 | * too. 43 | */ 44 | #define INST_DIVIDED_MODRM (0xc0) 45 | 46 | /* This is the escape byte value used for 3DNow! instructions. */ 47 | #define _3DNOW_ESCAPE_BYTE (0x0f) 48 | 49 | #define PREFIX_LOCK (0xf0) 50 | #define PREFIX_REPNZ (0xf2) 51 | #define PREFIX_REP (0xf3) 52 | #define PREFIX_CS (0x2e) 53 | #define PREFIX_SS (0x36) 54 | #define PREFIX_DS (0x3e) 55 | #define PREFIX_ES (0x26) 56 | #define PREFIX_FS (0x64) 57 | #define PREFIX_GS (0x65) 58 | #define PREFIX_OP_SIZE (0x66) 59 | #define PREFIX_ADDR_SIZE (0x67) 60 | #define PREFIX_VEX2b (0xc5) 61 | #define PREFIX_VEX3b (0xc4) 62 | 63 | /* REX prefix value range, 64 bits mode decoding only. */ 64 | #define PREFIX_REX_LOW (0x40) 65 | #define PREFIX_REX_HI (0x4f) 66 | /* In order to use the extended GPR's we have to add 8 to the Modr/M info 67 | * values. */ 68 | #define EX_GPR_BASE (8) 69 | 70 | /* Mask for REX and VEX features: */ 71 | /* Base */ 72 | #define PREFIX_EX_B (1) 73 | /* Index */ 74 | #define PREFIX_EX_X (2) 75 | /* Register */ 76 | #define PREFIX_EX_R (4) 77 | /* Operand Width */ 78 | #define PREFIX_EX_W (8) 79 | /* Vector Lengh */ 80 | #define PREFIX_EX_L (0x10) 81 | 82 | #endif /* X86DEFS_H */ 83 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/entrypoint/OpenSource2SDK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "OpenSource2SDK.hpp" 6 | 7 | EXTERN_C IMAGE_DOS_HEADER __ImageBase; 8 | #define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase) 9 | 10 | std::chrono::duration time_since(std::chrono::system_clock::time_point time) { 11 | return std::chrono::system_clock::now().time_since_epoch() - 12 | time.time_since_epoch(); 13 | } 14 | 15 | WaitUntilModulesLoaded_t os2::entrypoint::WaitUntilModulesLoaded( 16 | std::chrono::duration timeout, 17 | std::chrono::duration pool_rate) { 18 | const auto start_timestamp = std::chrono::system_clock::now(); 19 | 20 | HANDLE hProcess = GetCurrentProcess(); 21 | 22 | if (hProcess == NULL) { 23 | std::this_thread::sleep_for(timeout); 24 | return std::make_pair(std::string(), timeout); 25 | } 26 | 27 | HMODULE hModules[1024]; 28 | DWORD cbNeeded; 29 | 30 | std::set modulesSet = {}; 31 | 32 | auto load_timestamp = std::chrono::system_clock::now(); 33 | 34 | std::string last_module_name = ""; 35 | 36 | while (true) { 37 | const auto time_since_last_module = time_since(load_timestamp); 38 | 39 | if (time_since_last_module >= timeout) { 40 | return std::make_pair(last_module_name, time_since(start_timestamp)); 41 | } 42 | 43 | if (EnumProcessModules(hProcess, hModules, sizeof(hModules), &cbNeeded)) { 44 | unsigned int i; 45 | for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) { 46 | char szModName[MAX_PATH]; 47 | 48 | if (GetModuleFileNameExA(hProcess, hModules[i], szModName, 49 | sizeof(szModName) / sizeof(TCHAR))) { 50 | std::string moduleName = std::string(szModName); 51 | 52 | if (moduleName.find(os2::entrypoint::game_path_part) != std::string::npos) { 53 | auto insertStatus = modulesSet.insert(moduleName); 54 | 55 | const bool didInsert = insertStatus.second; 56 | 57 | // Actually inserted value into the set (it is a new value) 58 | if (didInsert) { 59 | load_timestamp = std::chrono::system_clock::now(); 60 | last_module_name = moduleName.substr(moduleName.rfind('\\') + 1); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | 67 | std::this_thread::sleep_for(pool_rate); 68 | } 69 | } 70 | 71 | void os2::entrypoint::BeginUnloadProcedure() noexcept { 72 | HANDLE hThread = CreateThread( 73 | nullptr, NULL, 74 | [](LPVOID pData) -> DWORD { 75 | FreeLibraryAndExitThread((HMODULE)(pData), EXIT_SUCCESS); 76 | }, 77 | HINST_THISCOMPONENT, NULL, nullptr); 78 | 79 | if (hThread != NULL) { 80 | CloseHandle(hThread); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/entrypoint/OpenSource2SDK.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "../sdk/utilities/static_string.hpp" 9 | 10 | typedef std::pair> 11 | WaitUntilModulesLoaded_t; 12 | 13 | #define DEBUG_PREFIX os2::entrypoint::debug_console_prefix 14 | 15 | namespace os2::entrypoint { 16 | const std::string game_path_part = os2_string( 17 | "Steam\\steamapps\\common\\Counter-Strike Global " 18 | "Offensive\\game"); 19 | 20 | const std::string debug_console_title = os2_string("OpenSource2 SDK"); 21 | 22 | const std::string debug_console_prefix = os2_string("[OpenSource2 SDK] "); 23 | 24 | namespace debug { 25 | /** 26 | * @brief "Loaded all modules, last: %s. Took %.2f s\n" 27 | */ 28 | const std::string modules_loaded = 29 | os2_string("Loaded all modules, last: %s. Took %.2f s\n"); 30 | } // namespace debug 31 | 32 | /** 33 | * @brief Waits till the game loads all modules. Does not hardcode module names. 34 | * @param timeout Time after function considers the module loading ends 35 | * @param pool_rate Thread sleep time duration between enumerating modules 36 | * @return 37 | */ 38 | WaitUntilModulesLoaded_t WaitUntilModulesLoaded( 39 | std::chrono::duration timeout = std::chrono::milliseconds(1500), 40 | std::chrono::duration pool_rate = std::chrono::milliseconds(15)); 41 | 42 | void BeginUnloadProcedure() noexcept; 43 | }; // namespace os2::entrypoint 44 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/entrypoint/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #define LOAD_SDK_FILES 3 | #include "OpenSource2SDK.hpp" 4 | #include "../sdk/framework.hpp" 5 | #include "../features/features.hpp" 6 | 7 | #include 8 | #include 9 | 10 | // static Config* g_Config = Config::GetInstance("CONFIG"); 11 | 12 | EXTERN_C IMAGE_DOS_HEADER __ImageBase; 13 | #define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase) 14 | 15 | #if OPENSOURCE2_ENABLE_LOGGING 16 | void InitialiseConsole() { 17 | AllocConsole(); 18 | 19 | SetConsoleTitleA(os2::entrypoint::debug_console_title.c_str()); 20 | 21 | // Enable I/O 22 | freopen_s(reinterpret_cast stdin, "CONIN$", "r", stdin); 23 | freopen_s(reinterpret_cast stdout, "CONOUT$", "w", stdout); 24 | } 25 | #endif 26 | 27 | void InitialiseSDK() { 28 | std::setlocale(LC_ALL, ".utf8"); 29 | 30 | #if OPENSOURCE2_ENABLE_LOGGING 31 | InitialiseConsole(); 32 | #endif 33 | 34 | [[maybe_unused]] const auto moduleInfo = os2::entrypoint::WaitUntilModulesLoaded(); 35 | 36 | LOG(os2::entrypoint::debug::modules_loaded.c_str(), moduleInfo.first.c_str(), 37 | moduleInfo.second.count()); 38 | 39 | gameFeatures.emplace(); 40 | 41 | os2::iface::initialise(); 42 | os2::memory::initialise(); 43 | os2::hooks::initialise(); 44 | } 45 | 46 | void UnloadSDK() { 47 | os2::hooks::shutdown(); 48 | os2::memory::shutdown(); 49 | os2::iface::shutdown(); 50 | 51 | if (gameFeatures.has_value()) gameFeatures.reset(); 52 | 53 | #if OPENSOURCE2_ENABLE_LOGGING 54 | fclose(stdin); 55 | fclose(stdout); 56 | FreeConsole(); 57 | #endif 58 | } 59 | 60 | BOOL WINAPI DllMain( HMODULE hModule, DWORD fdwReason, LPVOID lpvReserved) 61 | { 62 | if (fdwReason == DLL_PROCESS_ATTACH) { 63 | DisableThreadLibraryCalls(hModule); 64 | 65 | HANDLE hThread = CreateThread( 66 | nullptr, NULL, reinterpret_cast(InitialiseSDK), 67 | NULL, NULL, nullptr); 68 | 69 | if (hThread != NULL) { 70 | CloseHandle(hThread); 71 | } 72 | } else if (fdwReason == DLL_PROCESS_DETACH && !lpvReserved) { 73 | UnloadSDK(); 74 | } 75 | 76 | return TRUE; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/aim_enhancement/aimbot.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../feature.hpp" 6 | 7 | #include "../../sdk/source-sdk/classes/entity/c_csplayerpawn.hpp" 8 | #include "../../sdk/source-sdk/classes/entity/ccsplayercontroller.hpp" 9 | 10 | struct PlayerEntityBase_t { 11 | __int64 index; 12 | os2::sdk::C_CSPlayerPawn* pPawn; 13 | os2::sdk::CCSPlayerController* pController; 14 | }; 15 | 16 | struct PlayerEntity_t { 17 | PlayerEntityBase_t base; 18 | std::string szPlayerName; 19 | std::string szPlaceName; 20 | uint8_t iTeam; 21 | float fDistance; 22 | float fFovDistance; 23 | bool bIsInFov; 24 | bool bIsVisible; 25 | float fDegAngle; 26 | }; 27 | 28 | class AimBot : public Feature { 29 | public: 30 | CONSTRUCT_FEATURE(AimBot) {} 31 | 32 | CONFIG_GETTER(bool, Enabled) 33 | CONFIG_GETTER(bool, DrawGUI) 34 | CONFIG_GETTER(bool, DrawAimFOV) 35 | CONFIG_GETTER(float, FovRange) 36 | 37 | void RenderUI() noexcept; 38 | 39 | void OnRender() noexcept override; 40 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 41 | os2::sdk::CUserCmd* pUserCmd, 42 | glm::vec3& view_angles) noexcept override; 43 | void OnLevelInit() noexcept override; 44 | void OnRemoveEntity(os2::sdk::CEntityInstance* pInstance, 45 | os2::sdk::CHandle hHandle) noexcept override; 46 | 47 | nlohmann::json ToJson() const override { 48 | return {{("enabled"), config_.Enabled}, 49 | {("draw_gui"), config_.DrawGUI}, 50 | {("draw_aim_fov"), config_.DrawAimFOV}, 51 | {("fov_range"), config_.FovRange}}; 52 | } 53 | 54 | void FromJson(const nlohmann::json& j) override { 55 | config_.Enabled = j.at(("enabled")).get(); 56 | config_.DrawGUI = j.at(("draw_gui")).get(); 57 | config_.DrawAimFOV = j.at(("draw_aim_fov")).get(); 58 | config_.FovRange = j.at(("fov_range")).get(); 59 | } 60 | 61 | private: 62 | struct AimBotConfig { 63 | bool Enabled = false; 64 | bool DrawGUI = false; 65 | bool DrawAimFOV = true; 66 | float FovRange = 80.00f; 67 | } config_; 68 | 69 | std::map entities_; 70 | std::mutex entities_mutex; 71 | 72 | void RenderAimFOV() noexcept; 73 | 74 | bool IsVisibleByTraceLine(os2::sdk::C_CSPlayerPawn* pLocalPawn, 75 | const glm::vec3& vecTarget, 76 | int iEntryIndex) noexcept; 77 | }; 78 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/aim_enhancement/recoil_control.cpp: -------------------------------------------------------------------------------- 1 | #include "recoil_control.hpp" 2 | 3 | #include 4 | 5 | #include "../../game/state.hpp" 6 | #include "../../menu/menu.hpp" 7 | 8 | using namespace Game; 9 | using namespace os2::sdk; 10 | 11 | void RecoilControl::OnRender() noexcept { RenderUI(); } 12 | 13 | void RecoilControl::RenderUI() noexcept { 14 | if (!DrawGUI() || !os2::menu::IsOpen()) return; 15 | 16 | ImGui::PushFont(os2::menu::fonts::libertad_mono); 17 | 18 | ImGui::SetNextWindowSize({500, 0}); 19 | 20 | ImGui::Begin(this->Name(), &DrawGUI(), ImGuiWindowFlags_AlwaysAutoResize); 21 | 22 | ImGui::Checkbox("Enable Recoil Control", &Enabled()); 23 | ImGui::SliderFloat("Perfection in X-axis", &PerfectionX(), 0.f, 100.f, 24 | "%.3f"); 25 | ImGui::SliderFloat("Perfection in Y-axis", &PerfectionY(), 0.f, 100.f, 26 | "%.3f"); 27 | 28 | ImGui::PopFont(); 29 | 30 | ImGui::End(); 31 | } 32 | 33 | void RecoilControl::OnCreateMove(CCSGOInput* pCsgoInput, CUserCmd* pUserCmd, 34 | glm::vec3& view_angles) noexcept { 35 | if (!Enabled()) return; 36 | 37 | if (!os2::iface::pEngine->IsInGame()) return; 38 | 39 | if (!State::LocalPawn) return; 40 | 41 | auto aimPunch = State::LocalPawn->m_aimPunchCache(); 42 | 43 | if (aimPunch.m_size > 0 && aimPunch.m_size < 0xFFFF) { 44 | auto recoil = aimPunch.m_data[aimPunch.m_size - 1]; 45 | 46 | static glm::vec3 prev = glm::vec3(0.f, 0.f, 0.f); 47 | 48 | auto delta = prev - recoil; 49 | 50 | delta.x *= PerfectionX() / 100.f; 51 | delta.y *= PerfectionY() / 100.f; 52 | 53 | this->bulletsPre.push_back(delta); 54 | 55 | view_angles += delta; 56 | 57 | os2::math::ClampAngle(view_angles); 58 | 59 | os2::fn::SetViewAngles(pCsgoInput, 0, view_angles); 60 | 61 | this->bulletsPost.push_back(view_angles); 62 | 63 | prev = recoil; 64 | } else { 65 | this->bulletsPre.clear(); 66 | this->bulletsPost.clear(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/aim_enhancement/recoil_control.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../feature.hpp" 4 | 5 | class RecoilControl : public Feature { 6 | public: 7 | CONSTRUCT_FEATURE(RecoilControl) {} 8 | 9 | CONFIG_GETTER(bool, Enabled) 10 | CONFIG_GETTER(bool, DrawGUI) 11 | CONFIG_GETTER(float, PerfectionX) 12 | CONFIG_GETTER(float, PerfectionY) 13 | 14 | void RenderUI() noexcept; 15 | 16 | void OnRender() noexcept override; 17 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 18 | os2::sdk::CUserCmd* pUserCmd, 19 | glm::vec3& view_angles) noexcept override; 20 | 21 | nlohmann::json ToJson() const override { 22 | return {{("enabled"), config_.Enabled}, 23 | {("draw_gui"), config_.DrawGUI}, 24 | {("perfection_x"), config_.PerfectionX}, 25 | {("perfection_y"), config_.PerfectionY}}; 26 | } 27 | 28 | void FromJson(const nlohmann::json& j) override { 29 | config_.Enabled = j.at(("enabled")).get(); 30 | config_.DrawGUI = j.at(("draw_gui")).get(); 31 | config_.PerfectionX = j.at(("perfection_x")).get(); 32 | config_.PerfectionY = j.at(("perfection_y")).get(); 33 | } 34 | 35 | private: 36 | struct RecoilControlConfig { 37 | bool Enabled = false; 38 | bool DrawGUI = false; 39 | float PerfectionX = 100.f; 40 | float PerfectionY = 100.f; 41 | } config_; 42 | 43 | std::vector bulletsPre{}; 44 | std::vector bulletsPost{}; 45 | }; 46 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/drawing/drawing.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../feature.hpp" 4 | 5 | class Drawing : public Feature { 6 | public: 7 | CONSTRUCT_FEATURE(Drawing) {} 8 | 9 | void OnRender() noexcept override; 10 | 11 | void RenderOnScreen(const std::string& input, unsigned int text_color = 0xFFFFFFFF) noexcept; 12 | void RenderOnScreen(const std::string& input, ImVec4 text_color) noexcept; 13 | void RenderOnScreen(const char* input, unsigned int text_color = 0xFFFFFFFF) noexcept; 14 | void RenderOnScreen(const char* input, ImVec4 text_color) noexcept; 15 | 16 | void ClearScreenText() noexcept; 17 | 18 | void RenderShadow(ImVec2 position, float width, float height, 19 | float rounding = 0.0f, int shadowOffset = 2, 20 | int shadowLayers = 3, 21 | unsigned int color = 0x20000000) noexcept; 22 | void RenderProgressBar(ImVec2 position, float width, unsigned int color, 23 | float progress, bool shadow = true) noexcept; 24 | void RenderCenteredTextWithOutline(ImVec2 position, float width, float height, 25 | std::string text, 26 | unsigned int textColor = 0xFF000000, 27 | unsigned int textBorderColor = 0xFFFFFFFF, 28 | float offset = 1.0f) noexcept; 29 | 30 | void RenderArrowToAngle(const ImVec2& center, float angleRadians, 31 | float offset = 0.f) noexcept; 32 | 33 | unsigned int BombColorFade(float x, float y) noexcept; 34 | 35 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 36 | os2::sdk::CUserCmd* pUserCmd, 37 | glm::vec3& view_angles) noexcept override {} 38 | 39 | nlohmann::json ToJson() const override { return {}; } 40 | 41 | void FromJson(const nlohmann::json& j) override {} 42 | 43 | private: 44 | std::vector> displayed_info; 45 | std::mutex displayed_info_mutex; 46 | 47 | void DrawInfo(const std::string& input, __int64 index, 48 | unsigned int text_color) noexcept; 49 | }; 50 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/feature.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "../sdk/interfaces/interfaces.hpp" 10 | #include "../sdk/memory/memory.hpp" 11 | 12 | class Features; 13 | 14 | #define CONSTRUCT_FEATURE(FEATURE_NAME) \ 15 | FEATURE_NAME(Features* pFeatures_) : Feature(#FEATURE_NAME, pFeatures_) 16 | 17 | class Feature { 18 | private: 19 | const char* name_; 20 | 21 | protected: 22 | const Features* pFeatures; 23 | 24 | public: 25 | Feature(const char* className, Features* pFeatures_) 26 | : pFeatures(pFeatures_), name_(className) {} 27 | 28 | const char* Name() const { return name_; } 29 | 30 | virtual ~Feature() = default; 31 | 32 | virtual void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 33 | os2::sdk::CUserCmd*, 34 | glm::vec3& view_angles) noexcept = 0; 35 | virtual void OnFrameStageNotify(os2::sdk::CSource2Client*, 36 | const std::int32_t) noexcept {} 37 | virtual void OnRender() noexcept = 0; 38 | virtual void OnLevelInit() noexcept {} 39 | virtual void OnRemoveEntity(os2::sdk::CEntityInstance* pInstance, 40 | os2::sdk::CHandle hHandle) noexcept {} 41 | 42 | virtual nlohmann::json ToJson() const = 0; 43 | virtual void FromJson(const nlohmann::json& j) = 0; 44 | }; 45 | 46 | #define CONFIG_GETTER(TYPE, NAME) \ 47 | TYPE&##NAME() { return config_.NAME; } 48 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/features.cpp: -------------------------------------------------------------------------------- 1 | #include "features.hpp" 2 | 3 | #include "../menu/menu.hpp" 4 | #include "../sdk/hooks/hooks.hpp" 5 | 6 | #define IS_UNLOADING (os2::hooks::g_isShuttingDown) 7 | 8 | void Features::OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, os2::sdk::CUserCmd* cmd, 9 | glm::vec3& view_angles) noexcept { 10 | if (IS_UNLOADING) return; 11 | 12 | bunnyHop->OnCreateMove(pCsgoInput, cmd, view_angles); 13 | recoilControl->OnCreateMove(pCsgoInput, cmd, view_angles); 14 | triggerBot->OnCreateMove(pCsgoInput, cmd, view_angles); 15 | aimBot->OnCreateMove(pCsgoInput, cmd, view_angles); 16 | } 17 | 18 | [[maybe_unused]] void Features::OnFrameStageNotify() noexcept {} 19 | 20 | void Features::OnRender() noexcept { 21 | if (IS_UNLOADING) return; 22 | 23 | ImGui::PushFont(os2::menu::fonts::red_hat_display); 24 | 25 | esp->OnRender(); 26 | bunnyHop->OnRender(); 27 | recoilControl->OnRender(); 28 | triggerBot->OnRender(); 29 | aimBot->OnRender(); 30 | fov_changer->OnRender(); 31 | drawing->OnRender(); 32 | 33 | ImGui::PopFont(); 34 | } 35 | 36 | void Features::OnLevelInit() noexcept { 37 | if (IS_UNLOADING) return; 38 | 39 | aimBot->OnLevelInit(); 40 | } 41 | 42 | void Features::OnRemoveEntity(os2::sdk::CEntityInstance* pInstance, 43 | os2::sdk::CHandle hHandle) noexcept { 44 | if (IS_UNLOADING) return; 45 | 46 | aimBot->OnRemoveEntity(pInstance, hHandle); 47 | } 48 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/features.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "aim_enhancement/recoil_control.hpp" 7 | #include "aim_enhancement/aimbot.hpp" 8 | #include "esp/esp.hpp" 9 | #include "movement/bunnyhop.hpp" 10 | #include "triggerbot/triggerbot.hpp" 11 | #include "drawing/drawing.hpp" 12 | #include "fov_changer/fov_changer.hpp" 13 | 14 | class Features { 15 | public: 16 | std::unique_ptr bunnyHop = std::make_unique(this); 17 | std::unique_ptr recoilControl = 18 | std::make_unique(this); 19 | std::unique_ptr aimBot = std::make_unique(this); 20 | std::unique_ptr triggerBot = std::make_unique(this); 21 | std::unique_ptr esp = std::make_unique(this); 22 | std::unique_ptr drawing = std::make_unique(this); 23 | std::unique_ptr fov_changer = std::make_unique(this); 24 | 25 | public: 26 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, os2::sdk::CUserCmd* cmd, 27 | glm::vec3& view_angles) noexcept; 28 | 29 | [[maybe_unused]] void OnFrameStageNotify() noexcept; 30 | 31 | void OnRender() noexcept; 32 | 33 | void OnLevelInit() noexcept; 34 | 35 | void OnRemoveEntity(os2::sdk::CEntityInstance* pInstance, 36 | os2::sdk::CHandle hHandle) noexcept; 37 | }; 38 | 39 | inline std::optional gameFeatures; 40 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/fov_changer/fov_changer.cpp: -------------------------------------------------------------------------------- 1 | #include "fov_changer.hpp" 2 | 3 | #include "../../menu/menu.hpp" 4 | 5 | #include "../../game/state.hpp" 6 | 7 | void FovChanger::OnRender() noexcept { FovChanger::RenderUI(); } 8 | 9 | void FovChanger::RenderUI() noexcept { 10 | if (!DrawGUI() || !os2::menu::IsOpen()) return; 11 | 12 | ImGui::PushFont(os2::menu::fonts::libertad_mono); 13 | 14 | ImGui::Begin(this->Name(), &DrawGUI(), ImGuiWindowFlags_AlwaysAutoResize); 15 | 16 | ImGui::SeparatorText("Scene FOV - this is for fun :D"); 17 | ImGui::Checkbox("Change Scene FOV", &ChangeSceneFOV()); 18 | ImGui::SliderFloat("Scene FOV", &SceneCameraFOV(), 40, 140, "%.f"); 19 | 20 | ImGui::SliderFloat("In-Game FOV", &InGameFOV(), 40, 140, "%.f"); 21 | 22 | ImGui::PopFont(); 23 | 24 | ImGui::End(); 25 | } 26 | 27 | void FovChanger::SetSceneCameraFOV(float fov) noexcept { 28 | this->config_.SceneCameraFOV = fov; 29 | } 30 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/fov_changer/fov_changer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../feature.hpp" 4 | 5 | class FovChanger : public Feature { 6 | public: 7 | CONSTRUCT_FEATURE(FovChanger) {} 8 | 9 | CONFIG_GETTER(bool, Enabled) 10 | CONFIG_GETTER(bool, DrawGUI) 11 | CONFIG_GETTER(bool, ChangeSceneFOV) 12 | CONFIG_GETTER(float, SceneCameraFOV) 13 | CONFIG_GETTER(float, InGameFOV) 14 | 15 | void RenderUI() noexcept; 16 | 17 | void SetSceneCameraFOV(float fov) noexcept; 18 | 19 | void OnRender() noexcept override; 20 | 21 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 22 | os2::sdk::CUserCmd* pUserCmd, 23 | glm::vec3& view_angles) noexcept override {} 24 | 25 | nlohmann::json ToJson() const override { 26 | return {{("enabled"), config_.Enabled}, 27 | {("draw_gui"), config_.DrawGUI}, 28 | {("change_scene_fov"), config_.ChangeSceneFOV}, 29 | {("scene_camera_fov"), config_.SceneCameraFOV}, 30 | {("in_game_fov", config_.InGameFOV)}}; 31 | } 32 | 33 | void FromJson(const nlohmann::json& j) override { 34 | config_.Enabled = j.at(("enabled")).get(); 35 | config_.DrawGUI = j.at(("draw_gui")).get(); 36 | config_.ChangeSceneFOV = j.at(("change_scene_fov")).get(); 37 | config_.SceneCameraFOV = j.at(("scene_camera_fov")).get(); 38 | config_.InGameFOV = j.at(("in_game_fov")).get(); 39 | } 40 | 41 | private: 42 | struct BunnyhopConfig { 43 | bool Enabled = false; 44 | bool DrawGUI = false; 45 | bool ChangeSceneFOV = false; 46 | float SceneCameraFOV = 100.f; 47 | float InGameFOV = 90.f; 48 | } config_; 49 | }; 50 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/game_hooks/game_hooks.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../sdk/hooks/hook.hpp" 4 | #include "../../sdk/interfaces/interfaces.hpp" 5 | 6 | using namespace os2::sdk; 7 | 8 | typedef CHook MouseInputEnabled_t; 9 | typedef CHook 11 | GetMatricesForView_t; 12 | typedef CHook OnAddEntity_t; 13 | typedef CHook 14 | OnRemoveEntity_t; 15 | typedef CHook 16 | CreateMove_t; 17 | typedef CHook FrameStageNotify_t; 18 | typedef CHook<__int64 __fastcall(void*)> LevelInit_t; 19 | typedef CHook SetInGameFOV_t; 20 | typedef CHook<__int64 __fastcall(void*, int)> GetInGameFOVPtr_t; 21 | typedef CHook 24 | GetMaterialForDraw_t; 25 | typedef CHook<__int64 __fastcall(void*, unsigned int, __int64**, int, 26 | C_SoundData*, unsigned __int8)> 27 | EmitFootstepSound_t; 28 | 29 | namespace CHooks { 30 | static MouseInputEnabled_t MouseInputEnabled; 31 | static GetMatricesForView_t GetMatricesForView; 32 | static OnAddEntity_t OnAddEntity; 33 | static OnRemoveEntity_t OnRemoveEntity; 34 | static CreateMove_t CreateMove; 35 | static FrameStageNotify_t FrameStageNotify; 36 | static LevelInit_t LevelInit; 37 | static SetInGameFOV_t SetInGameFOV; 38 | static GetInGameFOVPtr_t GetInGameFOVPtr; 39 | static GetMaterialForDraw_t GetMaterialForDraw; 40 | static EmitFootstepSound_t EmitFootstepSound; 41 | }; // namespace CHooks 42 | 43 | namespace Hooks { 44 | static bool __fastcall MouseInputEnabled(void* rcx); 45 | static void __fastcall GetMatricesForView(void* rcx, void* view, 46 | VMatrix* pWorldToView, 47 | VMatrix* pViewToProjection, 48 | VMatrix* pWorldToProjection, 49 | VMatrix* pWorldToPixels); 50 | static void* __fastcall OnAddEntity(void* rcx, CEntityInstance* pInstance, 51 | CHandle hHandle); 52 | static void* __fastcall OnRemoveEntity(void* rcx, CEntityInstance* pInstance, 53 | CHandle hHandle); 54 | static void __fastcall CreateMove(CCSGOInput* input, const std::int32_t slot, 55 | const bool active); 56 | static void __fastcall FrameStageNotify(void* rcx, const std::int32_t stage); 57 | static __int64 __fastcall LevelInit(void* rcx); 58 | static void __fastcall SetInGameFOV(void* rcx, float fov); 59 | static __int64 __fastcall GetInGameFOVPtr(void* rcx, int a2); 60 | static CMaterial2* __fastcall GetMaterialForDraw( 61 | CBaseSceneObjectDesc* scene_object_desc, CMaterial2* material, 62 | CMaterialDrawDescriptor* material_draw_descriptor, 63 | ISceneLayer* scene_layer, bool& unknown); 64 | static __int64 __fastcall EmitFootstepSound(void*, unsigned int, __int64**, 65 | int, C_SoundData*, 66 | unsigned __int8); 67 | }; // namespace Hooks 68 | 69 | const enum EHookIndexes { 70 | ON_ADD_ENTITY = 14, // CGameEntitySystem instance 71 | ON_REMOVE_ENTITY = 15, // CGameEntitySystem instance 72 | CREATE_MOVE = 5, // CCSGOInput 73 | FRAME_STAGE_NOTIFY = 31, // Client interface 74 | }; 75 | 76 | namespace os2 { 77 | namespace game { 78 | void initialise(); 79 | void unhook(); 80 | }; // namespace game 81 | }; // namespace os2 82 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/helpers/draw_utilities.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // WIP 4 | 5 | #define IMGUI_DEFINE_MATH_OPERATORS 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "../../sdk/shaders/build/gaussian_blur.hpp" 16 | 17 | class DrawUtilities { 18 | public: 19 | static DrawUtilities& instance() noexcept { 20 | static DrawUtilities drawUtilities; 21 | return drawUtilities; 22 | } 23 | 24 | static void initialise(ID3D11Device* pD3D11Device, 25 | ID3D11DeviceContext* pD3D11DeviceContext) { 26 | instance().Initialise(pD3D11Device, pD3D11DeviceContext); 27 | } 28 | 29 | static void destroy() { instance().Destroy(); } 30 | 31 | static void draw(ImDrawList* drawList, const ImVec2& p_min, 32 | const ImVec2& p_max, float alpha) noexcept { 33 | instance().draw(drawList, p_min, p_max, alpha); 34 | } 35 | 36 | static void begin_blur(const ImDrawList*, const ImDrawCmd*) noexcept { 37 | instance().BeginBlur(); 38 | } 39 | 40 | static void perform_horizontal_blur(const ImDrawList*, 41 | const ImDrawCmd*) noexcept { 42 | instance().PerformHorizontalBlur(); 43 | } 44 | 45 | static void perform_vertical_blur(const ImDrawList*, 46 | const ImDrawCmd*) noexcept { 47 | instance().PerformVerticalBlur(); 48 | } 49 | 50 | static void end_blur(const ImDrawList*, const ImDrawCmd*) noexcept { 51 | instance().EndBlur(); 52 | } 53 | 54 | void Initialise(ID3D11Device* pD3D11Device, 55 | ID3D11DeviceContext* pD3D11DeviceContext); 56 | 57 | void SetDevice(ID3D11Device* pD3D11Device) { this->pDevice = pD3D11Device; } 58 | 59 | void SetContext(ID3D11DeviceContext* pD3D11DeviceContext); 60 | 61 | void ClearTextures(); 62 | 63 | bool CreateShaders(); 64 | 65 | ID3D11Texture2D* CreateTexture(int width, int height); 66 | 67 | bool CreateTextures(); 68 | 69 | bool CreateOffscreenResources(); 70 | 71 | bool CreateSampler(); 72 | 73 | bool CreateBackbufferSRV(); 74 | 75 | bool InitialiseVSConstantBuffer(); 76 | 77 | void SetOffscreenRenderTarget() noexcept; 78 | 79 | ID3D11ShaderResourceView* GetOffscreenShaderResourceView() noexcept; 80 | 81 | void DefineFullscrenQuad() noexcept; 82 | 83 | void RenderFullscrenQuad() noexcept; 84 | 85 | void CopyBackbufferToTexture(ID3D11Texture2D* pDstTexture, 86 | D3D11_FILTER filter) noexcept; 87 | 88 | void SetVertexShaderConstants(const DirectX::XMMATRIX& matrix); 89 | 90 | void BeginBlur() noexcept; 91 | 92 | void PerformHorizontalBlur() noexcept; 93 | 94 | void PerformVerticalBlur() noexcept; 95 | 96 | void EndBlur() noexcept; 97 | 98 | void DrawBlur(ImDrawList* drawList, const ImVec2& p_min, const ImVec2& p_max, 99 | float alpha) noexcept; 100 | 101 | bool IsReady() { return bIsReady; } 102 | 103 | void Destroy(); 104 | 105 | private: 106 | DrawUtilities() = default; 107 | DrawUtilities(const DrawUtilities&) = delete; 108 | 109 | static constexpr inline int BlurDownsample = 2; 110 | 111 | struct Vertex { 112 | float x, y, z; 113 | float u, v; 114 | }; 115 | 116 | struct VSConstants { 117 | DirectX::XMMATRIX projection; 118 | }; 119 | 120 | ~DrawUtilities() { Destroy(); } 121 | 122 | int backbuffer_width = 0; 123 | int backbuffer_height = 0; 124 | 125 | bool bIsReady = false; 126 | 127 | template 128 | void ReleaseResource(T*& resource); 129 | 130 | // DirectX 131 | ID3D11Device* pDevice = nullptr; 132 | ID3D11DeviceContext* pContext = nullptr; 133 | 134 | // Pixel shaders 135 | ID3D11PixelShader* pGaussianBlurX = nullptr; 136 | ID3D11PixelShader* pGaussianBlurY = nullptr; 137 | ID3D11PixelShader* pCopyPSShader = nullptr; 138 | 139 | // Gaussian blur textures 140 | ID3D11Texture2D* pGaussianBlurTextureX = nullptr; 141 | ID3D11Texture2D* pGaussianBlurTextureY = nullptr; 142 | 143 | // Backbuffer holding 144 | ID3D11RenderTargetView* pOffscreenRenderTargetView = nullptr; 145 | ID3D11ShaderResourceView* pOffscreenShaderResourceView = nullptr; 146 | 147 | // Fullscreen quad 148 | ID3D11Buffer* pVertexBuffer = nullptr; 149 | ID3D11SamplerState* pSampler = nullptr; 150 | 151 | // Backbuffer 152 | ID3D11Texture2D* pBackBufferTexture = nullptr; 153 | ID3D11ShaderResourceView* pBackBufferSRV = nullptr; 154 | 155 | // Raster 156 | ID3D11RasterizerState* pRasterState = nullptr; 157 | 158 | // Constant buffer 159 | ID3D11Buffer* pVSConstantBuffer = nullptr; 160 | }; 161 | 162 | inline DrawUtilities* g_pDrawUtilities; 163 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/helpers/post_processing.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // WIP 4 | 5 | #define IMGUI_DEFINE_MATH_OPERATORS 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "../../sdk/shaders/build/gaussian_blur.hpp" 16 | 17 | struct VSConstants { 18 | DirectX::XMMATRIX projection; 19 | }; 20 | 21 | namespace PostProcessing { 22 | void setDevice(ID3D11Device* device, ID3D11DeviceContext* deviceContext, 23 | ID3D11RenderTargetView* renderTarget, 24 | IDXGISwapChain* swapChain) noexcept; 25 | void clearBlurTextures() noexcept; 26 | void onDeviceReset() noexcept; 27 | void performFullscreenBlur(ImDrawList* drawList, float alpha) noexcept; 28 | void performBlur(ImDrawList* drawList, const ImVec2& p_min, const ImVec2& p_max, 29 | float alpha) noexcept; 30 | } // namespace PostProcessing 31 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/movement/bunnyhop.cpp: -------------------------------------------------------------------------------- 1 | #include "bunnyhop.hpp" 2 | 3 | #include "../../game/state.hpp" 4 | #include "../../menu/menu.hpp" 5 | 6 | using namespace Game; 7 | using namespace os2::sdk; 8 | 9 | void BunnyHop::OnRender() noexcept { BunnyHop::RenderUI(); } 10 | 11 | void BunnyHop::RenderUI() noexcept { 12 | if (DrawWatermark()) { 13 | ImGui::PushFont(os2::menu::fonts::libertad_mono); 14 | 15 | ImGuiWindowFlags windowFlags = 16 | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | 17 | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize; 18 | if (!os2::menu::IsOpen()) windowFlags |= ImGuiWindowFlags_NoInputs; 19 | 20 | ImGui::SetNextWindowBgAlpha(0.3f); 21 | ImGui::SetNextWindowPos({ImGui::GetIO().DisplaySize.x - 300.f, 24.f}, 22 | ImGuiCond_Once); 23 | ImGui::Begin("Watermark", nullptr, windowFlags); 24 | 25 | if (os2::iface::pEngine->IsInGame()) { 26 | ImGui::Text("OpenSource2 | speed %.2f | map %s", 27 | State::LocalPawn != nullptr 28 | ? State::LocalPawn->m_vecVelocity().Length2D() 29 | : -1.f, 30 | State::GlobalVars->current_map_name); 31 | } else { 32 | ImGui::Text("OpenSource2 | Not In Game"); 33 | } 34 | 35 | ImGui::PopFont(); 36 | 37 | ImGui::End(); 38 | } 39 | 40 | if (!DrawGUI() || !os2::menu::IsOpen()) return; 41 | 42 | ImGui::PushFont(os2::menu::fonts::libertad_mono); 43 | 44 | ImGui::Begin(this->Name(), &DrawGUI(), ImGuiWindowFlags_AlwaysAutoResize); 45 | 46 | ImGui::Checkbox("Enable Auto BunnyHop", &Enabled()); 47 | ImGui::Checkbox("Draw Watermark", &DrawWatermark()); 48 | ImGui::SliderInt("BunnyHop Perfection", &Perfection(), 1, 100, "%i/100"); 49 | 50 | ImGui::PopFont(); 51 | 52 | ImGui::End(); 53 | } 54 | 55 | void BunnyHop::OnCreateMove(CCSGOInput* pCsgoInput, CUserCmd* pUserCmd, 56 | glm::vec3& view_angles) noexcept { 57 | if (!State::LocalPawn) return; 58 | 59 | if (!Enabled()) return; 60 | 61 | this->bWasLastTimeOnGround = State::LocalPawn->OnGround(); 62 | 63 | const float velocity = State::LocalPawn->m_vecVelocity().Length2D(); 64 | 65 | bool bShouldJump = true; 66 | 67 | if (velocity > 300.f && Perfection() < 0.8) bShouldJump = false; 68 | 69 | if (!State::LocalPawn->OnGround() && !bWasLastTimeOnGround) 70 | pUserCmd->m_buttons &= ~os2::sdk::IN_JUMP; 71 | 72 | this->bWasLastTimeOnGround = State::LocalPawn->OnGround(); 73 | } 74 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/movement/bunnyhop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../feature.hpp" 4 | 5 | class BunnyHop : public Feature { 6 | public: 7 | CONSTRUCT_FEATURE(BunnyHop), bWasLastTimeOnGround(false) {} 8 | 9 | CONFIG_GETTER(bool, Enabled) 10 | CONFIG_GETTER(bool, DrawGUI) 11 | CONFIG_GETTER(bool, DrawWatermark) 12 | CONFIG_GETTER(int, Perfection) 13 | 14 | void RenderUI() noexcept; 15 | 16 | void OnRender() noexcept override; 17 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 18 | os2::sdk::CUserCmd* pUserCmd, 19 | glm::vec3& view_angles) noexcept override; 20 | 21 | nlohmann::json ToJson() const override { 22 | return {{("enabled"), config_.Enabled}, 23 | {("draw_gui"), config_.DrawGUI}, 24 | {("draw_watermark"), config_.DrawWatermark}, 25 | {("perfection"), config_.Perfection}}; 26 | } 27 | 28 | void FromJson(const nlohmann::json& j) override { 29 | config_.Enabled = j.at(("enabled")).get(); 30 | config_.DrawGUI = j.at(("draw_gui")).get(); 31 | config_.DrawWatermark = j.at(("draw_watermark")).get(); 32 | config_.Perfection = j.at(("perfection")).get(); 33 | } 34 | 35 | private: 36 | struct BunnyhopConfig { 37 | bool Enabled = false; 38 | bool DrawGUI = false; 39 | bool DrawWatermark = false; 40 | int Perfection = 100; 41 | } config_; 42 | 43 | bool bWasLastTimeOnGround; 44 | }; 45 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/triggerbot/triggerbot.cpp: -------------------------------------------------------------------------------- 1 | #include "triggerbot.hpp" 2 | 3 | #include "../../game/state.hpp" 4 | #include "../../menu/menu.hpp" 5 | #include "../../sdk/source-sdk/classes/entity/c_csweaponbase.hpp" 6 | #include "../../sdk/source-sdk/classes/types/c_trace.hpp" 7 | 8 | #include "../features.hpp" 9 | 10 | using namespace Game; 11 | using namespace os2::sdk; 12 | 13 | void TriggerBot::OnRender() noexcept { 14 | TriggerBot::RenderUI(); 15 | } 16 | 17 | void TriggerBot::RenderUI() noexcept { 18 | if (!DrawGUI() || !os2::menu::IsOpen()) return; 19 | 20 | ImGui::PushFont(os2::menu::fonts::libertad_mono); 21 | 22 | ImGui::SetNextWindowSize({700, 0}); 23 | 24 | ImGui::Begin(this->Name(), &DrawGUI(), ImGuiWindowFlags_AlwaysAutoResize); 25 | 26 | ImGui::Checkbox("Enable TriggerBot", &Enabled()); 27 | ImGui::Checkbox("Enable Team Fire", &EnableTeamFire()); 28 | ImGui::SliderFloat("Max Flash Intensity", &MaxFlashIntensity(), 0, 1, "%.1f"); 29 | ImGui::SliderFloat("Max Smoke Density", &MaxSmokeDensity(), 0, 1, "%.1f"); 30 | ImGui::Checkbox("Scoped Only", &ScopedOnly()); 31 | 32 | ImGui::PopFont(); 33 | 34 | ImGui::End(); 35 | } 36 | 37 | void TriggerBot::OnCreateMove(CCSGOInput* pCsgoInput, CUserCmd* pUserCmd, 38 | glm::vec3& view_angles) noexcept { 39 | if (!Enabled()) return; 40 | 41 | if (!State::LocalController) return; 42 | 43 | if (!State::LocalPawn) return; 44 | 45 | if (!os2::iface::pEngine->IsInGame()) return; 46 | 47 | const auto pPawn = State::LocalPawn; 48 | 49 | CPlayer_WeaponServices* pWeaponServices = pPawn->m_pWeaponServices(); 50 | if (!pWeaponServices) return; 51 | 52 | C_CSWeaponBase* pWeapon = 53 | pWeaponServices->m_hActiveWeapon().Get(); 54 | if (!pWeapon) return; 55 | 56 | if (pWeapon->m_nNextPrimaryAttackTick() > State::GlobalVars->tick_count) { 57 | return; 58 | } 59 | 60 | C_AttributeContainer* pAttributeContainer = pWeapon->m_AttributeManager(); 61 | if (!pAttributeContainer) return; 62 | 63 | C_EconItemView* pItemView = pAttributeContainer->m_Item(); 64 | if (!pItemView) return; 65 | 66 | CCSWeaponBaseVData* weapon_info = pItemView->GetWeaponInfo(); 67 | if (!weapon_info) return; 68 | 69 | if (weapon_info->type() == CSWeaponType::Knife || 70 | weapon_info->type() == CSWeaponType::C4 || 71 | weapon_info->type() == CSWeaponType::Grenade || 72 | static_cast(weapon_info->type()) > 7) 73 | return; 74 | 75 | if (weapon_info->bulletsInClip() == 0) { 76 | return; 77 | } 78 | 79 | const auto aimPunch = pPawn->m_aimPunchCache(); 80 | glm::vec3 correction_vector{}; 81 | 82 | if (aimPunch.m_size > 0 && aimPunch.m_size < 0xFFFF) { 83 | correction_vector = aimPunch.m_data[aimPunch.m_size - 1]; 84 | } 85 | 86 | Vector start_pos = Vector{pPawn->GetEyePosition()}; 87 | Vector end_pos = 88 | start_pos + 89 | Vector{os2::math::FromAngle(view_angles + correction_vector) * weapon_info->range()}; 90 | 91 | C_TraceFilter filter(0x1C3003, pPawn, nullptr, 4); 92 | C_Ray ray; 93 | C_GameTrace trace; 94 | 95 | os2::fn::TraceShape(os2::fn::EngineTrace, &ray, &start_pos, &end_pos, &filter, 96 | &trace); 97 | 98 | if (!trace.HitEntity) return; 99 | 100 | if (trace.HitEntity->m_iTeamNum() == 0) return; 101 | 102 | if (!EnableTeamFire() && trace.HitEntity->m_iTeamNum() == pPawn->m_iTeamNum()) 103 | return; 104 | 105 | if (weapon_info->type() == CSWeaponType::SniperRifle && ScopedOnly() && 106 | !State::LocalPawn->m_bIsScoped()) 107 | return; 108 | 109 | float fFlashDuration = 110 | pPawn->m_flFlashBangTime() 111 | ? (pPawn->m_flFlashBangTime() - State::GlobalVars->current_time) / 112 | pPawn->m_flFlashDuration() 113 | : 0.f; 114 | 115 | const auto pDraw = pFeatures->drawing.get(); 116 | 117 | if (fFlashDuration > MaxFlashIntensity()) { 118 | pDraw->RenderOnScreen( 119 | std::format("Flash: {}%", std::floor(fFlashDuration * 100))); 120 | return; 121 | } 122 | 123 | float fDensity = 0; 124 | // os2::fn::TraceSmoke(&start_pos, &end_pos, nullptr); 125 | 126 | if (fDensity > MaxSmokeDensity()) { 127 | pDraw->RenderOnScreen(std::format("Smoke: {}%", std::floor(fDensity * 100)), 128 | ImVec4(255, 255, 0, 255)); 129 | return; 130 | }; 131 | 132 | pUserCmd->m_buttons |= IN_ATTACK; 133 | } 134 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/features/triggerbot/triggerbot.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "../feature.hpp" 10 | 11 | class TriggerBot : public Feature { 12 | public: 13 | CONSTRUCT_FEATURE(TriggerBot) {} 14 | 15 | CONFIG_GETTER(bool, Enabled) 16 | CONFIG_GETTER(bool, DrawGUI) 17 | CONFIG_GETTER(bool, EnableTeamFire) 18 | CONFIG_GETTER(float, MaxFlashIntensity) 19 | CONFIG_GETTER(float, MaxSmokeDensity) 20 | CONFIG_GETTER(bool, ScopedOnly) 21 | 22 | void RenderUI() noexcept; 23 | 24 | void OnRender() noexcept override; 25 | void OnCreateMove(os2::sdk::CCSGOInput* pCsgoInput, 26 | os2::sdk::CUserCmd* pUserCmd, 27 | glm::vec3& view_angles) noexcept override; 28 | 29 | nlohmann::json ToJson() const override { 30 | return {{("enabled"), config_.Enabled}, 31 | {("draw_gui"), config_.DrawGUI}, 32 | {("enable_team_fire"), config_.EnableTeamFire}, 33 | {("max_flash_intensity"), config_.MaxFlashIntensity}, 34 | {("max_smoke_density"), config_.MaxSmokeDensity}, 35 | {("scoped_only", config_.ScopedOnly)}}; 36 | } 37 | 38 | void FromJson(const nlohmann::json& j) override { 39 | config_.Enabled = j.at(("enabled")).get(); 40 | config_.DrawGUI = j.at(("draw_gui")).get(); 41 | config_.EnableTeamFire = j.at(("enable_team_fire")).get(); 42 | config_.MaxFlashIntensity = j.at(("max_flash_intensity")).get(); 43 | config_.MaxSmokeDensity = j.at(("max_smoke_density")).get(); 44 | config_.ScopedOnly = j.at(("scoped_only")).get(); 45 | } 46 | 47 | private: 48 | struct TriggerBotConfig { 49 | bool Enabled = false; 50 | bool DrawGUI = false; 51 | bool EnableTeamFire = false; 52 | float MaxFlashIntensity = 0.4f; 53 | float MaxSmokeDensity = 0.3f; 54 | bool ScopedOnly = true; 55 | } config_; 56 | }; 57 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/game/state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Game::State { 4 | inline os2::sdk::CCSPlayerController* LocalController = nullptr; 5 | inline os2::sdk::C_CSPlayerPawn* LocalPawn = nullptr; 6 | 7 | inline os2::sdk::CGlobalVarsBase* GlobalVars = nullptr; 8 | }; // namespace Game::State 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/gamedata/gamedata.cpp: -------------------------------------------------------------------------------- 1 | #include "gamedata.hpp" 2 | 3 | using namespace Game::Data; 4 | using namespace os2::sdk; 5 | 6 | void GameData::CacheCurrentEntities() { 7 | // This function runs ONCE on injection and caches all the entities if 8 | // you happen to inject connected on a server. 9 | if (!os2::iface::pEngine->IsInGame()) return; 10 | 11 | CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance(); 12 | if (!pEntitySystem) return; 13 | 14 | int highestIndex = pEntitySystem->GetHighestEntityIndex(); 15 | for (int i = 1; i <= highestIndex; ++i) { 16 | C_BaseEntity* pEntity = pEntitySystem->GetBaseEntity(i); 17 | 18 | if (!pEntity) continue; 19 | 20 | OnAddEntity(pEntity, pEntity->GetRefEHandle()); 21 | } 22 | } 23 | 24 | void GameData::OnAddEntity(CEntityInstance* pInst, CHandle handle) { 25 | C_BaseEntity* pEntity = reinterpret_cast(pInst); 26 | 27 | if (!pEntity) return; 28 | 29 | // Cache only networked entities. 30 | // https://developer.valvesoftware.com/wiki/Entity_limit#Source_2_limits 31 | if (handle.GetEntryIndex() >= 16384) return; 32 | 33 | auto it = std::find_if(g_cachedEntities.begin(), g_cachedEntities.end(), 34 | [handle](const Entity_t& i) { 35 | return i.handle.GetEntryIndex() == 36 | handle.GetEntryIndex(); 37 | }); 38 | 39 | if (it == g_cachedEntities.end()) { 40 | Entity_t cachedEntity{}; 41 | cachedEntity.handle = handle; 42 | cachedEntity.type = GameData::GetEntityType(pEntity); 43 | if (cachedEntity.type != EEntityType::UNKNOWN) 44 | g_cachedEntities.emplace_back(cachedEntity); 45 | } else { 46 | it->handle = handle; 47 | it->type = GameData::GetEntityType(pEntity); 48 | } 49 | } 50 | 51 | void GameData::OnRemoveEntity(CEntityInstance* pInst, CHandle handle) { 52 | C_BaseEntity* pEntity = reinterpret_cast(pInst); 53 | 54 | if (!pEntity) return; 55 | 56 | auto it = std::find_if( 57 | g_cachedEntities.begin(), g_cachedEntities.end(), 58 | [handle](const Entity_t& i) { return i.handle == handle; }); 59 | if (it == g_cachedEntities.end()) return; 60 | 61 | it->shouldDrawEsp = false; 62 | it->type = EEntityType::UNKNOWN; 63 | } 64 | 65 | EEntityType GameData::GetEntityType(C_BaseEntity* pEntity) { 66 | if (pEntity->IsBasePlayerController()) 67 | return EEntityType::PLAYER_CONTROLLER; 68 | else if (pEntity->IsBasePlayerWeapon()) 69 | return EEntityType::BASE_WEAPON; 70 | else if (pEntity->IsChicken()) 71 | return EEntityType::CHICKEN; 72 | else if (pEntity->IsPlantedC4()) 73 | return EEntityType::PLANTED_C4; 74 | 75 | return EEntityType::UNKNOWN; 76 | } 77 | 78 | void GameData::SetDrawList(ImDrawList* drawList) { 79 | g_pBackgroundDrawList = drawList; 80 | } 81 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/gamedata/gamedata.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define IMGUI_DEFINE_MATH_OPERATORS 9 | #include 10 | #include 11 | 12 | #include "../sdk/interfaces/interfaces.hpp" 13 | 14 | #include "../sdk/source-sdk/classes/entity/c_pointcamera.hpp" 15 | 16 | namespace Game::Data { 17 | struct ScrollingBuffer { 18 | int MaxSize; 19 | int Offset; 20 | ImVector Data; 21 | ScrollingBuffer(int max_size = 2000) { 22 | MaxSize = max_size; 23 | Offset = 0; 24 | Data.reserve(MaxSize); 25 | } 26 | void AddPoint(float x, float y) { 27 | if (Data.size() < MaxSize) 28 | Data.push_back(ImVec2(x, y)); 29 | else { 30 | Data[Offset] = ImVec2(x, y); 31 | Offset = (Offset + 1) % MaxSize; 32 | } 33 | } 34 | void Erase() { 35 | if (Data.size() > 0) { 36 | Data.shrink(0); 37 | Offset = 0; 38 | } 39 | } 40 | }; 41 | 42 | // utility structure for real-time plot 43 | struct RollingBuffer { 44 | float Span; 45 | ImVector Data; 46 | RollingBuffer() { 47 | Span = 10.0f; 48 | Data.reserve(2000); 49 | } 50 | void AddPoint(float x, float y) { 51 | float xmod = fmodf(x, Span); 52 | if (!Data.empty() && xmod < Data.back().x) Data.shrink(0); 53 | Data.push_back(ImVec2(xmod, y)); 54 | } 55 | }; 56 | 57 | enum EEntityType { 58 | UNKNOWN = -1, 59 | PLAYER_CONTROLLER, 60 | BASE_WEAPON, 61 | CHICKEN, 62 | PLANTED_C4, 63 | }; 64 | 65 | struct GamePlayer_t {}; 66 | 67 | struct Entity_t { 68 | os2::sdk::CHandle handle; 69 | EEntityType type; 70 | 71 | os2::sdk::BBox_t boundingBox; 72 | bool shouldDrawEsp; 73 | }; 74 | 75 | class GameData { 76 | public: 77 | GameData() : g_pBackgroundDrawList(nullptr) {} 78 | 79 | ImDrawList* DrawList() { return g_pBackgroundDrawList; } 80 | void SetDrawList(ImDrawList* drawList = ImGui::GetBackgroundDrawList()); 81 | 82 | std::vector& GetEntities() { return g_cachedEntities; } 83 | std::mutex& GetEntitiesMutex() { return g_cachedEntitiesMutex; } 84 | 85 | void CacheCurrentEntities(); 86 | void OnAddEntity(os2::sdk::CEntityInstance* pInst, 87 | os2::sdk::CHandle handle); 88 | void OnRemoveEntity(os2::sdk::CEntityInstance* pInst, 89 | os2::sdk::CHandle handle); 90 | 91 | static EEntityType GetEntityType(os2::sdk::C_BaseEntity* pEntity); 92 | 93 | private: 94 | ImDrawList* g_pBackgroundDrawList; 95 | std::vector g_cachedEntities; 96 | std::mutex g_cachedEntitiesMutex; 97 | }; 98 | 99 | inline std::optional g_pGameData; 100 | }; // namespace Game::Data 101 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/menu/components/TopBar.cpp: -------------------------------------------------------------------------------- 1 | #define IMGUI_DEFINE_MATH_OPERATORS 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "../menu.hpp" 8 | #include "../../features/features.hpp" 9 | 10 | using namespace os2::menu; 11 | 12 | void TopBar::MenuItemEx(const char* name, const char icon[], bool& stateVariable, 13 | const char* shortcut, bool enabled) noexcept { 14 | if (ImGui::MenuItemEx(name, icon, shortcut, stateVariable, enabled)) { 15 | stateVariable = !stateVariable; 16 | 17 | if (stateVariable) { 18 | ImGui::SetWindowFocus(name); 19 | ImGui::SetWindowPos(name, {100.0f, 100.0f}); 20 | } 21 | } 22 | } 23 | 24 | void TopBar::Render() noexcept { 25 | if (!IsOpen()) return; 26 | 27 | ImGuiStyle& style = ImGui::GetStyle(); 28 | 29 | ImStyleCache* style_cache = new ImStyleCache(style); 30 | 31 | style.FramePadding.y = 16; 32 | style.FramePadding.x = 16; 33 | style.ItemSpacing.x = 12; 34 | style.ItemSpacing.y = 4; 35 | 36 | style.IndentSpacing = 25; 37 | style.ScrollbarSize = 15; 38 | style.GrabMinSize = 10; 39 | style.WindowBorderSize = 1; 40 | style.ChildBorderSize = 1; 41 | style.PopupBorderSize = 1; 42 | style.FrameBorderSize = 1; 43 | style.TabBorderSize = 1; 44 | style.WindowRounding = 7; 45 | style.ChildRounding = 4; 46 | style.FrameRounding = 3; 47 | style.PopupRounding = 4; 48 | style.ScrollbarRounding = 9; 49 | style.GrabRounding = 3; 50 | style.LogSliderDeadzone = 4; 51 | style.TabRounding = 4; 52 | 53 | if (!ImGui::BeginMainMenuBar()) { 54 | style_cache->restore(style); 55 | return; 56 | } 57 | 58 | ImGui::PushFont(os2::menu::fonts::cartograph); 59 | 60 | ImGui::TextColored(ImVec4(BRAND_COLOR, 1.f), ICON_MDI_CROWN_OUTLINE); 61 | 62 | ImGui::PopFont(); 63 | 64 | ImGui::PushFont(os2::menu::fonts::libertad_mono); 65 | ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, 0.96f), "OpenSource2"); 66 | ImGui::TextColored(ImVec4(BRAND_COLOR, 0.87f), "SDK"); 67 | 68 | ImGui::PopFont(); 69 | ImGui::PushFont(os2::menu::fonts::cartograph); 70 | 71 | if (ImGui::BeginMenu("Aim")) { 72 | TopBar::MenuItemEx("Aim Assistance", ICON_MDI_ROBOT, 73 | gameFeatures->aimBot->DrawGUI(), 74 | "Aimbot"); 75 | TopBar::MenuItemEx("Auto Shoot", ICON_MDI_PISTOL, 76 | gameFeatures->triggerBot->DrawGUI(), 77 | "Triggerbot"); 78 | TopBar::MenuItemEx("Recoil Control", ICON_MDI_LESS_THAN, 79 | gameFeatures->recoilControl->DrawGUI(), 80 | "NoRecoil", true); 81 | TopBar::MenuItemEx("Spread Control", ICON_MDI_SHAKER, 82 | gameFeatures->bunnyHop->DrawGUI(), 83 | "NoSpread", false); 84 | TopBar::MenuItemEx("Prediction", ICON_MDI_MATRIX, 85 | gameFeatures->bunnyHop->DrawGUI(), 86 | "", 87 | false); 88 | TopBar::MenuItemEx("Self-learning progress", ICON_MDI_LAYERS_TRIPLE, 89 | gameFeatures->bunnyHop->DrawGUI(), "", false); 90 | 91 | TopBar::MenuItemEx("General Statistics", ICON_MDI_STAR_SHOOTING, 92 | gameFeatures->bunnyHop->DrawGUI(), "", false); 93 | 94 | ImGui::EndMenu(); 95 | } 96 | 97 | if (ImGui::BeginMenu("Visuals")) { 98 | TopBar::MenuItemEx("Players ESP", ICON_MDI_ACCOUNT_EYE_OUTLINE, 99 | gameFeatures->esp->DrawGUI()); 100 | TopBar::MenuItemEx("Bomb ESP", ICON_MDI_BOMB, gameFeatures->esp->DrawGUI()); 101 | TopBar::MenuItemEx("Chicken ESP", ICON_MDI_TURKEY, 102 | gameFeatures->esp->DrawGUI()); 103 | TopBar::MenuItemEx("FOV Changer", ICON_MDI_EYE, 104 | gameFeatures->fov_changer->DrawGUI()); 105 | ImGui::MenuItem("Custom Chams", ICON_MDI_PALETTE_ADVANCED); 106 | ImGui::MenuItem("Player Radar", ICON_MDI_RADAR); 107 | ImGui::MenuItem("World 3D Helpers", ICON_MDI_PRINTER_3D); 108 | ImGui::MenuItem("Grenade ESP", ICON_MDI_SCAN_HELPER); 109 | ImGui::EndMenu(); 110 | } 111 | 112 | if (ImGui::BeginMenu("Movement")) { 113 | TopBar::MenuItemEx("BunnyHop", ICON_MDI_RABBIT, gameFeatures->bunnyHop->DrawGUI()); 114 | ImGui::MenuItem("Auto Strafe"); 115 | ImGui::MenuItem("Edge Jump"); 116 | ImGui::MenuItem("Auto OP Jumps"); 117 | ImGui::MenuItem("Auto Stop"); 118 | ImGui::MenuItem("Auto Slow"); 119 | ImGui::MenuItem("Auto Crouch"); 120 | ImGui::MenuItem("Auto Defuse"); 121 | ImGui::EndMenu(); 122 | } 123 | 124 | if (ImGui::BeginMenu("General")) { 125 | ImGui::MenuItem("3D Sound ESP"); 126 | ImGui::MenuItem("Custom Sky"); 127 | ImGui::MenuItem("Night Mode"); 128 | ImGui::MenuItem("Custom Models"); 129 | ImGui::MenuItem("Web ESP"); 130 | ImGui::MenuItem("LED Physical Integration"); 131 | ImGui::EndMenu(); 132 | } 133 | 134 | if (ImGui::BeginMenu("Skin Changer")) { 135 | ImGui::MenuItem("Skin Changer"); 136 | ImGui::MenuItem("Inventory Changer"); 137 | ImGui::MenuItem("Fake Openings"); 138 | ImGui::MenuItem("Intercept Skins from Inspect"); 139 | ImGui::EndMenu(); 140 | } 141 | 142 | if (ImGui::BeginMenu("Config")) { 143 | ImGui::MenuItem("Instant New Save"); 144 | ImGui::MenuItem("Open Config Manager"); 145 | ImGui::MenuItem("Unload Cheat"); 146 | ImGui::EndMenu(); 147 | } 148 | 149 | ImGui::PopFont(); 150 | // ImGui::PopFont(); 151 | 152 | // End the main menu bar 153 | ImGui::EndMainMenuBar(); 154 | 155 | style_cache->restore(style); 156 | 157 | delete style_cache; 158 | } 159 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/menu/gui/gui.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //class ShaderProgram { 4 | // public: 5 | // ~ShaderProgram(); 6 | // 7 | // void use(float uniform, int location) const noexcept; 8 | // void create(const unsigned char fileBytes[]) noexcept; 9 | // 10 | // private: 11 | // bool bIsInitialised = false; 12 | //}; 13 | // 14 | //class BlurEffect { 15 | // public: 16 | // static void draw(ImDrawList* drawList, float alpha) noexcept { 17 | // instance()._draw(drawList, alpha); 18 | // } 19 | // 20 | // static void clear_textures() noexcept { 21 | // if (instance().blur_texture_1) { 22 | // instance().blur_texture_1->Release(); 23 | // instance().blur_texture_1 = nullptr; 24 | // } 25 | // if (instance().blur_texture_2) { 26 | // instance().blur_texture_2->Release(); 27 | // instance().blur_texture_2 = nullptr; 28 | // } 29 | // } 30 | // private: 31 | // ID3D11Texture2D* blur_texture_1 = nullptr; 32 | // ID3D11Texture2D* blur_texture_2 = nullptr; 33 | // 34 | // ID3D11RenderTargetView* m_offscreenTexture = nullptr; 35 | // ID3D11RenderTargetView* m_renderTargetView = nullptr; 36 | // ID3D11Texture2D* m_renderTarget1 = nullptr; 37 | // ID3D11Texture2D* m_renderTarget2 = nullptr; 38 | // 39 | // int backbuffer_width; 40 | // int backbuffer_height; 41 | // 42 | // static constexpr auto blur_downsample = 2; 43 | // 44 | // BlurEffect() = default; 45 | // BlurEffect(const BlurEffect&) = delete; 46 | // 47 | // ~BlurEffect() { 48 | // // if (rtBackup) rtBackup->Release(); 49 | // if (blur_texture_1) blur_texture_1->Release(); 50 | // if (blur_texture_2) blur_texture_2->Release(); 51 | // } 52 | // 53 | // static BlurEffect& instance() noexcept { 54 | // static BlurEffect blurEffect; 55 | // return blurEffect; 56 | // } 57 | // 58 | // static void begin(const ImDrawList*, const ImDrawCmd*) noexcept { 59 | // instance()._begin(); 60 | // } 61 | // 62 | // static void first_pass(const ImDrawList*, const ImDrawCmd*) noexcept { 63 | // instance()._first_pass(); 64 | // } 65 | // 66 | // static void second_pass(const ImDrawList*, const ImDrawCmd*) noexcept { 67 | // instance()._second_pass(); 68 | // } 69 | // 70 | // static void end(const ImDrawList*, const ImDrawCmd*) noexcept { 71 | // instance()._end(); 72 | // } 73 | // 74 | // void create_textures() noexcept; 75 | // void create_shaders() noexcept; 76 | // void _begin(IDXGISwapChain*) noexcept; 77 | // void _first_pass() noexcept; 78 | // void _second_pass() noexcept; 79 | // void _end() noexcept; 80 | // void _draw(ImDrawList* draw_list, float) noexcept; 81 | //}; 82 | // 83 | //namespace os2 { 84 | // namespace gui { 85 | // ImFont* add_font_from_vfont(const std::string& path, float size, 86 | // const ImWchar* glyphRanges, bool merge) noexcept; 87 | // ImWchar* get_font_glyph_ranges() noexcept; 88 | // }; 89 | //}; // namespace os2 90 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/menu/menu.cpp: -------------------------------------------------------------------------------- 1 | #define IMGUI_DEFINE_MATH_OPERATORS 2 | #include 3 | 4 | #include "menu.hpp" 5 | 6 | #include "../entrypoint/OpenSource2SDK.hpp" 7 | 8 | #include "../sdk/memory/memory.hpp" 9 | #include "../sdk/interfaces/interfaces.hpp" 10 | #include "../features/helpers/post_processing.hpp" 11 | 12 | #include "../game/state.hpp" 13 | 14 | inline bool g_showTable = false; 15 | 16 | #define MENU_WINDOW_WIDTH (const unsigned int)512 17 | 18 | bool os2::menu::ShowUnloadPopup() { 19 | ImGui::OpenPopup("Are You Sure?"); 20 | 21 | if (ImGui::BeginPopupModal("Are You Sure?", NULL, 22 | ImGuiWindowFlags_AlwaysAutoResize)) { 23 | ImGui::Text("Are you sure you want to continue?"); 24 | ImGui::Spacing(); 25 | 26 | if (ImGui::Button("Yes")) { 27 | os2::entrypoint::BeginUnloadProcedure(); 28 | } 29 | 30 | ImGui::SameLine(); 31 | 32 | if (ImGui::Button("No")) { 33 | ImGui::EndPopup(); 34 | 35 | return false; 36 | } 37 | 38 | ImGui::EndPopup(); 39 | } 40 | 41 | return true; 42 | } 43 | 44 | void os2::menu::Render() { 45 | static char classInputText[64]; 46 | 47 | ImGuiIO& IO = ImGui::GetIO(); 48 | IO.ConfigFlags = ImGuiConfigFlags_NoMouseCursorChange; 49 | 50 | if (ImGui::IsKeyPressed(ImGuiKey_Insert, false)) Toggle(!IsOpen()); 51 | 52 | if (!IsOpen()) return; 53 | 54 | IO.ConfigFlags = ImGuiConfigFlags_None; 55 | 56 | os2::fn::SDL_SetRelativeMouseMode(false); 57 | os2::fn::SDL_SetWindowGrab(os2::iface::pInputSystem->GetSDLWindow(), false); 58 | 59 | ImGui::SetNextWindowPos(IO.DisplaySize / 2.f, ImGuiCond_Once, {0.5f, 0.5f}); 60 | 61 | ImGui::PushFont(fonts::libertad_mono); 62 | 63 | ImGui::Begin("Analytics", &bIsOpen, ImGuiConfigFlags_None); 64 | 65 | // PostProcessing::performFullscreenBlur(ImGui::GetWindowDrawList(), 1.f); 66 | 67 | ImGui::Checkbox("Analytics Table", &g_showTable); 68 | 69 | if (g_showTable && 70 | ImGui::BeginTable("StandardData", 2, 71 | ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | 72 | ImGuiTableFlags_SizingStretchSame | 73 | ImGuiTableFlags_Resizable)) { 74 | ImGui::TableSetupColumn("Param"); 75 | ImGui::TableSetupColumn("Value"); 76 | ImGui::TableHeadersRow(); 77 | 78 | glm::vec2 screen = os2::iface::pEngine->GetScreenSize(); 79 | 80 | char width[16]; 81 | char height[16]; 82 | 83 | sprintf_s(width, "%.0f px", screen.x); 84 | sprintf_s(height, "%.0f px", screen.y); 85 | 86 | const std::array, 4> data = { 87 | std::make_pair("Is Connected", 88 | os2::iface::pEngine->IsConnected() ? "Yes" : "No"), 89 | std::make_pair("Is In Game", 90 | os2::iface::pEngine->IsInGame() ? "Yes" : "No"), 91 | std::make_pair("Screen Width", width), 92 | std::make_pair("Screen Height", height) 93 | }; 94 | 95 | for (auto i : data) { 96 | ImGui::TableNextRow(); 97 | ImGui::TableNextColumn(); 98 | ImGui::Text(i.first); 99 | ImGui::TableNextColumn(); 100 | ImGui::Text(i.second); 101 | } 102 | 103 | ImGui::EndTable(); 104 | } 105 | 106 | ImGui::SeparatorText("Other settings"); 107 | ImGui::SetNextItemWidth(MENU_WINDOW_WIDTH); 108 | ImGui::InputTextWithHint("##l0", "Class", classInputText, 109 | IM_ARRAYSIZE(classInputText)); 110 | 111 | if (ImGui::Button("Print class layout in game console", 112 | {MENU_WINDOW_WIDTH, 0})) 113 | os2::fn::SchemaDetailedClassLayout(nullptr, classInputText); 114 | 115 | if (ImGui::IsItemHovered()) 116 | ImGui::SetTooltip("Type 'C_BaseEntity' to understand what this does."); 117 | 118 | if (ImGui::Button("Unload", {MENU_WINDOW_WIDTH, 0})) { 119 | os2::entrypoint::BeginUnloadProcedure(); 120 | } 121 | 122 | ImGui::PopFont(); 123 | 124 | ImGui::End(); 125 | } 126 | 127 | void os2::menu::Toggle(bool bState) { 128 | if (!ImGui::GetCurrentContext() || !os2::iface::pInputSystem) return; 129 | 130 | bIsOpen = bState; 131 | 132 | if (os2::iface::pInputSystem->IsRelativeMouseMode()) { 133 | const ImVec2 screenCenter = ImGui::GetIO().DisplaySize / 2.f; 134 | 135 | os2::fn::SDL_SetRelativeMouseMode(!bIsOpen); 136 | os2::fn::SDL_SetWindowGrab(os2::iface::pInputSystem->GetSDLWindow(), !bIsOpen); 137 | os2::fn::SDL_WarpMouseInWindow(nullptr, screenCenter.x, screenCenter.y); 138 | } 139 | } 140 | 141 | bool os2::menu::IsOpen() { return bIsOpen; } 142 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/menu/menu.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IMGUI_DEFINE_MATH_OPERATORS 4 | #include 5 | 6 | #include "state.hpp" 7 | 8 | class ImStyleCache { 9 | public: 10 | ImStyleCache(ImGuiStyle& style) { 11 | this->FramePadding = style.FramePadding; 12 | this->ItemSpacing = style.ItemSpacing; 13 | } 14 | 15 | void restore(ImGuiStyle& style) { 16 | style.FramePadding = this->FramePadding; 17 | style.ItemSpacing = this->ItemSpacing; 18 | } 19 | 20 | private: 21 | ImVec2 FramePadding; 22 | ImVec2 ItemSpacing; 23 | }; 24 | 25 | namespace os2::menu { 26 | inline namespace fonts { 27 | inline ImFont* red_hat_display = nullptr; 28 | inline ImFont* red_hat_display_large = nullptr; 29 | inline ImFont* libertad_mono = nullptr; 30 | inline ImFont* cartograph = nullptr; 31 | inline ImFont* mdi = nullptr; 32 | } // namespace fonts 33 | 34 | bool ShowUnloadPopup(); 35 | void Render(); 36 | 37 | void Toggle(bool bState); 38 | bool IsOpen(); 39 | 40 | namespace TopBar { 41 | void MenuItemEx(const char* name, const char icon[], bool& stateVariable, 42 | const char* shortcut = "", bool enabled = true) noexcept; 43 | 44 | void Render() noexcept; 45 | }; // namespace TopBar 46 | }; // namespace os2::menu 47 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/menu/state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define BRAND_COLOR 0.79607844f, 0.6313726f, 0.20784314f 6 | 7 | namespace os2::menu { 8 | inline bool bIsOpen = false; 9 | 10 | struct Windows { 11 | bool AimAssist; 12 | bool AutoShoot; 13 | bool RecoilControl; 14 | bool SpreadControl; 15 | bool AimPrediction; 16 | bool NeuralAimStatus; 17 | bool AimStatistics; 18 | 19 | bool BunnyHop; 20 | bool ESP; 21 | }; 22 | }; // namespace os2::menu 23 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/fnv1a/hash_fnv1a_constexpr.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // FNV1a c++11 constexpr compile time hash functions, 32 and 64 bit 6 | // str should be a null terminated string literal, value should be left out 7 | // e.g hash_32_fnv1a_const("example") 8 | // code license: public domain or equivalent 9 | // post: https://notes.underscorediscovery.com/constexpr-fnv1a/ 10 | 11 | constexpr uint32_t val_32_const = 0x811c9dc5; 12 | constexpr uint32_t prime_32_const = 0x1000193; 13 | 14 | inline constexpr uint32_t hash_32_fnv1a_const( 15 | const char* const str, const uint32_t value = val_32_const) noexcept { 16 | return (str[0] == '\0') 17 | ? value 18 | : hash_32_fnv1a_const(&str[1], 19 | (value ^ uint32_t(str[0])) * prime_32_const); 20 | } 21 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/framework.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _DEBUG 4 | #define OPENSOURCE2_ENABLE_LOGGING 1 5 | #endif // DEBUG 6 | 7 | #ifdef NDEBUG 8 | #define OPENSOURCE2_ENABLE_LOGGING 0 9 | #endif // NDEBUG 10 | 11 | #include "api.hpp" 12 | 13 | #ifdef LOAD_SDK_FILES 14 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 15 | // Windows Header Files 16 | #include 17 | 18 | #include 19 | 20 | // Compile-time string encryption. Strings are decoded in run-time. 21 | // In static analysis strings are the simplest trace, easiest to identify. 22 | // Thanks to this small helper no obvious trace of the SDK in strings is left in the compiled file. 23 | #include "utilities/static_string.hpp" 24 | 25 | // [SDK]: In-game classes schema helper 26 | #include "schema/schema.hpp" 27 | 28 | // [SDK] Virtual function 29 | #include "virtual/virtual.hpp" 30 | 31 | // [SDK]: Source 2 SDK definitions 32 | #include "source-sdk/source-sdk.hpp" 33 | 34 | // [SDK]: Interface definition 35 | #include "interface/interface.hpp" 36 | 37 | // [SDK]: Game modules representation 38 | #include "module/module.hpp" 39 | 40 | // Interfaces: game structures grouping necessary methods for a convenient access 41 | #include "interfaces/interfaces.hpp" 42 | 43 | // Memory: scans game memory searching for memory patterns of 44 | // essential game functions and internals, by their byte signature 45 | 46 | // Finds essential game functions and internals, scanning game memory trying to // 47 | // match signatures defined in the SDK. Signatures are being found 48 | // in the act of reverse engineering the game binaries 49 | #include "memory/memory.hpp" 50 | 51 | // [SDK]: Hook utility class 52 | #include "hooks/hook.hpp" 53 | 54 | // Function execution manipulation 55 | #include "hooks/hooks.hpp" 56 | 57 | // DirectX 11 shaders 58 | // [...] 59 | 60 | // Math helpers 61 | #include "math/math.hpp" 62 | #endif 63 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/hooks/hook.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "../virtual/virtual.hpp" 8 | 9 | #define HOOK_FUNCTION(hook) hook, #hook 10 | 11 | namespace os2::sdk { 12 | namespace strings { 13 | inline const std::string log_hook_success = 14 | os2_string("%s hooked successfully. [ %p -> %p ]\n"); 15 | inline const std::string log_hook_fail = os2_string("%s hook failed.\n"); 16 | }; // namespace strings 17 | 18 | inline funchook_t *funchook_ctx = nullptr; 19 | 20 | template 21 | class CHook { 22 | public: 23 | std::add_pointer_t m_pOriginal; 24 | // Template has been used to avoid casts. 25 | template 26 | void Hook(OriginalT _pOriginalFn, HookT &pHookFn, const char *szHookName) { 27 | if (this->m_pOriginal) return; 28 | 29 | void *pOriginalFn = static_cast(_pOriginalFn); 30 | 31 | if (!pOriginalFn) return; 32 | 33 | this->m_pOriginal = 34 | reinterpret_castm_pOriginal)>(pOriginalFn); 35 | 36 | int rv = funchook_prepare(funchook_ctx, 37 | reinterpret_cast(&this->m_pOriginal), 38 | reinterpret_cast(pHookFn)); 39 | 40 | if (rv == FUNCHOOK_ERROR_SUCCESS) { 41 | LOG(strings::log_hook_success.c_str(), szHookName, pOriginalFn, pHookFn); 42 | } else { 43 | this->m_pOriginal = nullptr; 44 | LOG(strings::log_hook_fail.c_str(), szHookName); 45 | } 46 | } 47 | 48 | template 49 | void HookVirtual(void *pClass, int index, HookT &pHookFn, 50 | const char *szHookName) { 51 | this->Hook(vmt::GetVMethod(index, pClass), pHookFn, szHookName); 52 | } 53 | 54 | template 55 | auto operator()(Args &&...args) 56 | -> decltype(std::invoke(this->m_pOriginal, 57 | std::forward(args)...)) { 58 | return std::invoke(this->m_pOriginal, std::forward(args)...); 59 | } 60 | }; 61 | }; // namespace os2::sdk 62 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/hooks/hooks.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "hooks.hpp" 4 | 5 | #include "../memory/memory.hpp" 6 | #include "../hooks/hook.hpp" 7 | 8 | #include "../../features/game_hooks/game_hooks.hpp" 9 | 10 | void os2::hooks::initialise() { 11 | os2::sdk::funchook_ctx = funchook_create(); 12 | 13 | if (!os2::sdk::funchook_ctx) return; 14 | 15 | using namespace os2::hooks; 16 | 17 | input->Enter(); 18 | os2::game::initialise(); 19 | graphics->Enter(); 20 | 21 | if (funchook_install(os2::sdk::funchook_ctx, 0) != FUNCHOOK_ERROR_SUCCESS) 22 | return; 23 | 24 | LOG(strings::log_hooks_initialised.c_str()); 25 | } 26 | 27 | void os2::hooks::shutdown() { 28 | using namespace os2::hooks; 29 | 30 | g_isShuttingDown = true; 31 | 32 | if (!os2::sdk::funchook_ctx) return; 33 | 34 | input->Leave(); 35 | os2::game::unhook(); 36 | graphics->Leave(); 37 | 38 | if (funchook_uninstall(os2::sdk::funchook_ctx, 0) != FUNCHOOK_ERROR_SUCCESS) 39 | return; 40 | 41 | std::this_thread::sleep_for(std::chrono::milliseconds(100)); 42 | 43 | if (funchook_destroy(os2::sdk::funchook_ctx) != FUNCHOOK_ERROR_SUCCESS) 44 | return; 45 | } 46 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/hooks/hooks.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wndproc/wndproc_hook.hpp" 4 | #include "directx11/directx11_hook.hpp" 5 | 6 | namespace os2::hooks { 7 | namespace strings { 8 | static inline const std::string log_hooks_initialised = 9 | os2_string("[+] Hooks Initialise() successful.\n"); 10 | }; // namespace strings 11 | 12 | inline bool g_isShuttingDown = false; 13 | 14 | void initialise(); 15 | void shutdown(); 16 | 17 | inline std::shared_ptr input = std::make_shared(); 18 | inline std::shared_ptr graphics = std::make_shared(); 19 | }; // namespace os2::hooks 20 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/hooks/wndproc/wndproc_hook.cpp: -------------------------------------------------------------------------------- 1 | #include "wndproc_hook.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "../../../menu/menu.hpp" 10 | 11 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, 12 | WPARAM wParam, 13 | LPARAM lParam); 14 | 15 | LRESULT WndProcHook::hkWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, 16 | LPARAM lParam) { 17 | if (!ImGui::GetCurrentContext()) { 18 | ImGui::CreateContext(); 19 | ImPlot::CreateContext(); 20 | ImGui_ImplWin32_Init(hWnd); 21 | ImGuiIO &io = ImGui::GetIO(); 22 | io.IniFilename = io.LogFilename = nullptr; 23 | } 24 | 25 | ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); 26 | 27 | if (os2::menu::IsOpen()) { 28 | // Messages handled by 'ImGui_ImplWin32_WndProcHandler'. 29 | switch (uMsg) { 30 | case WM_MOUSEMOVE: 31 | case WM_NCMOUSEMOVE: 32 | case WM_MOUSELEAVE: 33 | case WM_NCMOUSELEAVE: 34 | case WM_LBUTTONDOWN: 35 | case WM_LBUTTONDBLCLK: 36 | case WM_RBUTTONDOWN: 37 | case WM_RBUTTONDBLCLK: 38 | case WM_MBUTTONDOWN: 39 | case WM_MBUTTONDBLCLK: 40 | case WM_XBUTTONDOWN: 41 | case WM_XBUTTONDBLCLK: 42 | case WM_LBUTTONUP: 43 | case WM_RBUTTONUP: 44 | case WM_MBUTTONUP: 45 | case WM_XBUTTONUP: 46 | case WM_MOUSEWHEEL: 47 | case WM_MOUSEHWHEEL: 48 | case WM_KEYDOWN: 49 | case WM_KEYUP: 50 | case WM_SYSKEYDOWN: 51 | case WM_SYSKEYUP: 52 | case WM_SETFOCUS: 53 | case WM_KILLFOCUS: 54 | case WM_CHAR: 55 | case WM_SETCURSOR: 56 | case WM_DEVICECHANGE: 57 | return 1; 58 | } 59 | } 60 | 61 | return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam); 62 | } 63 | 64 | BOOL CALLBACK WndProcHook::EnumWindowsCallback(HWND handle, LPARAM lParam) { 65 | const auto isMainWindow = [handle]() { 66 | return GetWindow(handle, GW_OWNER) == nullptr && IsWindowVisible(handle) && 67 | handle != GetConsoleWindow(); 68 | }; 69 | 70 | DWORD pID = 0; 71 | GetWindowThreadProcessId(handle, &pID); 72 | 73 | if (GetCurrentProcessId() != pID || !isMainWindow()) return TRUE; 74 | 75 | *reinterpret_cast(lParam) = handle; 76 | return FALSE; 77 | } 78 | 79 | void WndProcHook::Enter() { 80 | while (!hWindow) { 81 | EnumWindows(WndProcHook::EnumWindowsCallback, reinterpret_cast(&hWindow)); 82 | std::this_thread::sleep_for(std::chrono::milliseconds(100)); 83 | } 84 | 85 | oWndProc = reinterpret_cast(SetWindowLongPtr( 86 | hWindow, GWLP_WNDPROC, reinterpret_cast(hkWndProc))); 87 | 88 | LOG(WndProcHook::szAfterHookLog.c_str()); 89 | } 90 | 91 | void WndProcHook::Leave() { 92 | if (oWndProc) { 93 | SetWindowLongPtr(hWindow, GWLP_WNDPROC, 94 | reinterpret_cast(oWndProc)); 95 | 96 | LOG(WndProcHook::szAfterLeaveLog.c_str()); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/hooks/wndproc/wndproc_hook.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "../../utilities/static_string.hpp" 9 | #include "../../framework.hpp" 10 | 11 | class WndProcHook { 12 | private: 13 | static inline HWND hWindow = nullptr; 14 | static inline WNDPROC oWndProc = NULL; 15 | 16 | static inline std::string szAfterHookLog = os2_string("Hooked Input API!\n"); 17 | static inline std::string szAfterLeaveLog = 18 | os2_string("Restored original Input API!\n"); 19 | 20 | static LRESULT hkWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 21 | 22 | static BOOL CALLBACK EnumWindowsCallback(HWND handle, LPARAM lParam); 23 | 24 | public: 25 | void Enter(); 26 | void Leave(); 27 | 28 | constexpr static HWND GetGameWindow() { return hWindow; } 29 | }; 30 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/interface/interface.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | typedef void *(*InstantiateInterfaceFn)(); 5 | 6 | // Used internally to register classes. 7 | struct InterfaceReg { 8 | InstantiateInterfaceFn m_CreateFn; 9 | const char *m_pName; 10 | InterfaceReg *m_pNext; // For the global list. 11 | }; 12 | }; // namespace os2::sdk 13 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/interfaces/interfaces.cpp: -------------------------------------------------------------------------------- 1 | #include "interfaces.hpp" 2 | 3 | #include "../module/module.hpp" 4 | 5 | #define FIND_INTERFACE(dst, module, version) \ 6 | module->FindInterface(version.c_str()).Get(dst, "os2::iface::" #dst); 7 | 8 | void os2::iface::initialise() { 9 | using namespace os2::sdk; 10 | using namespace os2::memory::strings; 11 | 12 | os2::module::client = CModule::Create(client_dll); 13 | os2::module::engine = CModule::Create(engine2_dll); 14 | os2::module::schemasystem = CModule::Create(schemasystem_dll); 15 | os2::module::inputsystem = CModule::Create(inputsystem_dll); 16 | os2::module::tier0 = CModule::Create(tier0_dll); 17 | os2::module::localize = CModule::Create(localize_dll); 18 | os2::module::materialsystem = CModule::Create(materialsystem2_dll); 19 | os2::module::scenesystem = CModule::Create(scenesystem_dll); 20 | 21 | FIND_INTERFACE(pGameResourceService, os2::module::engine, 22 | game_resource_service_client); 23 | FIND_INTERFACE(pClient, os2::module::client, source2_client); 24 | FIND_INTERFACE(pSchemaSystem, os2::module::schemasystem, schema_system); 25 | FIND_INTERFACE(pInputSystem, os2::module::inputsystem, input_system_version); 26 | FIND_INTERFACE(pEngine, os2::module::engine, source2_engine); 27 | FIND_INTERFACE(pCvar, os2::module::tier0, engine_cvar); 28 | FIND_INTERFACE(pLocalize, os2::module::localize, localize); 29 | FIND_INTERFACE(pMaterialSystem, os2::module::materialsystem, material_system2); 30 | } 31 | 32 | void os2::iface::shutdown() {} 33 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/interfaces/interfaces.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../source-sdk/interfaces/cgameresourceserviceclient.hpp" 4 | #include "../source-sdk/classes/cgameentitysystem.hpp" 5 | #include "../source-sdk/interfaces/csource2client.hpp" 6 | #include "../source-sdk/interfaces/cschemasystem.hpp" 7 | #include "../source-sdk/interfaces/cengineclient.hpp" 8 | #include "../source-sdk/interfaces/cinputsystem.hpp" 9 | #include "../source-sdk/classes/cgameevent.hpp" 10 | #include "../source-sdk/interfaces/clocalize.hpp" 11 | #include "../source-sdk/interfaces/ccvar.hpp" 12 | #include "../source-sdk/classes/cmaterial2.hpp" 13 | #include "../source-sdk/interfaces/cmaterialsystem2.hpp" 14 | #include "../source-sdk/interfaces/iscenelayer.hpp" 15 | 16 | namespace os2 { 17 | namespace module { 18 | inline std::shared_ptr client; 19 | inline std::shared_ptr engine; 20 | inline std::shared_ptr schemasystem; 21 | inline std::shared_ptr inputsystem; 22 | inline std::shared_ptr tier0; 23 | inline std::shared_ptr localize; 24 | inline std::shared_ptr materialsystem; 25 | inline std::shared_ptr scenesystem; 26 | }; // namespace module 27 | 28 | namespace iface { 29 | void initialise(); 30 | void shutdown(); 31 | 32 | inline os2::sdk::CGameResourceService* pGameResourceService; 33 | inline os2::sdk::CSource2Client* pClient; 34 | inline os2::sdk::CSchemaSystem* pSchemaSystem; 35 | inline os2::sdk::CInputSystem* pInputSystem; 36 | inline os2::sdk::CEngineClient* pEngine; 37 | inline os2::sdk::CCvar* pCvar; 38 | inline os2::sdk::CLocalize* pLocalize; 39 | inline os2::sdk::CMaterialSystem2* pMaterialSystem; 40 | }; // namespace iface 41 | }; // namespace os2 42 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/classes/transform.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "transform.hpp" 4 | 5 | glm::mat3x4 CTransform::ToMatrix() const noexcept { 6 | glm::mat3x4 matrix{}; 7 | 8 | const auto& rot = m_Orientation; 9 | const auto& pos = m_Position; 10 | 11 | matrix[0][0] = 1.0f - 2.0f * rot.y * rot.y - 2.0f * rot.z * rot.z; 12 | matrix[1][0] = 2.0f * rot.x * rot.y + 2.0f * rot.w * rot.z; 13 | matrix[2][0] = 2.0f * rot.x * rot.z - 2.0f * rot.w * rot.y; 14 | 15 | matrix[0][1] = 2.0f * rot.x * rot.y - 2.0f * rot.w * rot.z; 16 | matrix[1][1] = 1.0f - 2.0f * rot.x * rot.x - 2.0f * rot.z * rot.z; 17 | matrix[2][1] = 2.0f * rot.y * rot.z + 2.0f * rot.w * rot.x; 18 | 19 | matrix[0][2] = 2.0f * rot.x * rot.z + 2.0f * rot.w * rot.y; 20 | matrix[1][2] = 2.0f * rot.y * rot.z - 2.0f * rot.w * rot.x; 21 | matrix[2][2] = 1.0f - 2.0f * rot.x * rot.x - 2.0f * rot.y * rot.y; 22 | 23 | matrix[0][3] = pos.x; 24 | matrix[1][3] = pos.y; 25 | matrix[2][3] = pos.z; 26 | 27 | return matrix; 28 | } 29 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/classes/transform.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "vector.hpp" 4 | #include "../types/quaternion.hpp" 5 | 6 | class alignas(16) CTransform { 7 | public: 8 | alignas(16) os2::sdk::Vector m_Position; 9 | alignas(16) os2::sdk::Quaternion m_Orientation; 10 | 11 | glm::mat3x4 ToMatrix() const noexcept; 12 | }; 13 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/classes/vector.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace os2::sdk { 8 | class Vector { 9 | public: 10 | Vector(const glm::vec3& vec) noexcept : x{vec.x}, y{vec.y}, z{vec.z} {} 11 | Vector(float x_, float y_, float z_) noexcept : x{x_}, y{y_}, z{z_} {} 12 | Vector() noexcept : x(0.f), y(0.f), z(0.f) {} 13 | 14 | inline Vector operator+(const Vector& rhs) const noexcept { 15 | return Vector{this->x + rhs.x, this->y + rhs.y, this->z + rhs.z}; 16 | } 17 | 18 | inline Vector operator-(const Vector& rhs) const noexcept { 19 | return Vector{this->x - rhs.x, this->y - rhs.y, this->z - rhs.z}; 20 | } 21 | 22 | inline Vector operator*(const float rhs) const noexcept { 23 | return Vector{this->x * rhs, this->y * rhs, this->z * rhs}; 24 | } 25 | 26 | inline Vector operator/(const float rhs) const noexcept { 27 | return Vector{this->x / rhs, this->y / rhs, this->z / rhs}; 28 | } 29 | 30 | inline float Length2D() const noexcept { return std::sqrt(x * x + y * y); } 31 | 32 | inline glm::vec3 glm() const noexcept { return glm::vec3{x, y, z}; } 33 | 34 | float x, y, z; 35 | }; 36 | 37 | class Vector4D { 38 | public: 39 | inline glm::vec4 glm() const noexcept { return glm::vec4{x, y, z, w}; } 40 | 41 | float x, y, z, w; 42 | }; 43 | }; // namespace os2::sdk 44 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/classes/vmatrix.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace os2::sdk { 6 | class VMatrix { 7 | public: 8 | inline glm::mat4x4 glm() const noexcept { 9 | return glm::mat4x4{m[0][0], m[0][1], m[0][2], m[0][3], 10 | m[1][0], m[1][1], m[1][2], m[1][3], 11 | m[2][0], m[2][1], m[2][2], m[2][3], 12 | m[3][0], m[3][1], m[3][2], m[3][3]}; 13 | } 14 | 15 | auto operator[](int i) const noexcept { return m[i]; } 16 | 17 | float m[4][4]; 18 | }; 19 | }; // namespace os2::sdk 20 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/math.cpp: -------------------------------------------------------------------------------- 1 | #include "math.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define IMGUI_DEFINE_MATH_OPERATORS 8 | #include 9 | #include 10 | 11 | #include "../interfaces/interfaces.hpp" 12 | #include "../memory/memory.hpp" 13 | 14 | inline glm::mat4x4 m_ViewMatrix; 15 | 16 | // An alternative way to calculate the world to screen matrix. 17 | void os2::math::UpdateViewMatrix(os2::sdk::VMatrix* pViewMatrix) noexcept { 18 | if (!pViewMatrix) return; 19 | m_ViewMatrix = pViewMatrix->glm(); 20 | } 21 | 22 | // s/o: 23 | // https://github.com/bruhmoment21/cs2-sdk/blob/dc9636aad20975a052d779b771e5708db80051be/cs2-sdk/src/math/math.cpp#L39 24 | bool os2::math::WorldToScreen(const os2::sdk::Vector& in, 25 | ImVec2& out) noexcept { 26 | if (!ImGui::GetCurrentContext()) return false; 27 | 28 | const float z = m_ViewMatrix[3][0] * in.x + m_ViewMatrix[3][1] * in.y + 29 | m_ViewMatrix[3][2] * in.z + m_ViewMatrix[3][3]; 30 | if (z < 0.001f) return false; 31 | 32 | out = ImGui::GetIO().DisplaySize * 0.5f; 33 | out.x *= 1.0f + (m_ViewMatrix[0][0] * in.x + m_ViewMatrix[0][1] * in.y + 34 | m_ViewMatrix[0][2] * in.z + m_ViewMatrix[0][3]) / 35 | z; 36 | out.y *= 1.0f - (m_ViewMatrix[1][0] * in.x + m_ViewMatrix[1][1] * in.y + 37 | m_ViewMatrix[1][2] * in.z + m_ViewMatrix[1][3]) / 38 | z; 39 | 40 | // Prevents rounded corners. 41 | out = ImFloor(out); 42 | 43 | return true; 44 | } 45 | 46 | // s/o: 47 | // https://github.com/bruhmoment21/cs2-sdk/blob/dc9636aad20975a052d779b771e5708db80051be/cs2-sdk/src/math/math.cpp#L39 48 | void os2::math::TransformAABB(const glm::mat3x4& mat, const glm::vec3& minsIn, 49 | const glm::vec3& maxsIn, glm::vec3& minsOut, 50 | glm::vec3& maxsOut) noexcept { 51 | const glm::vec3 localCenter{(minsIn + maxsIn) * 0.5f}; 52 | const glm::vec3 localExtent{maxsIn - localCenter}; 53 | 54 | const glm::vec3 worldAxisX{mat[0][0], mat[0][1], mat[0][2]}; 55 | const glm::vec3 worldAxisY{mat[1][0], mat[1][1], mat[1][2]}; 56 | const glm::vec3 worldAxisZ{mat[2][0], mat[2][1], mat[2][2]}; 57 | 58 | const glm::vec3 worldCenter = VecTransformMatrix(localCenter, mat); 59 | const glm::vec3 worldExtent{AbsoluteDotProduct(localExtent, worldAxisX), 60 | AbsoluteDotProduct(localExtent, worldAxisY), 61 | AbsoluteDotProduct(localExtent, worldAxisZ)}; 62 | 63 | minsOut = worldCenter - worldExtent; 64 | maxsOut = worldCenter + worldExtent; 65 | } 66 | 67 | void os2::math::ClampAngle(glm::vec3& angle) noexcept { 68 | NormalizeAngle(angle); 69 | 70 | angle.x = std::clamp(angle.x, -89.0f, 89.0f); 71 | angle.y = std::clamp(angle.y, -180.0f, 180.0f); 72 | angle.z = 0.0f; 73 | } 74 | 75 | void os2::math::NormalizeAngle(glm::vec3& angle) noexcept { 76 | angle.x = std::remainderf(angle.x, 180.f); 77 | angle.y = std::remainderf(angle.y, 360.f); 78 | } 79 | 80 | glm::vec3 os2::math::ToAngle(const glm::vec3& vec) noexcept { 81 | return {glm::degrees(std::atan2(-vec.z, std::hypot(vec.x, vec.y))), 82 | glm::degrees(std::atan2(vec.y, vec.y)), 0.00f}; 83 | } 84 | 85 | glm::vec3 os2::math::CalculateRelativeAngle( 86 | const glm::vec3 source, const glm::vec3 dest, 87 | const glm::vec3& view_angles) noexcept { 88 | glm::vec3 delta = dest - source; 89 | 90 | ToAngle(delta); 91 | 92 | delta -= view_angles; 93 | 94 | NormalizeAngle(delta); 95 | 96 | return delta; 97 | } 98 | 99 | float os2::math::CalculateFOV(const glm::vec3& source, 100 | const glm::vec3& dest) noexcept { 101 | glm::vec3 delta = dest - source; 102 | 103 | os2::math::NormalizeAngle(delta); 104 | 105 | return glm::length(delta); 106 | } 107 | 108 | float os2::math::CalculateAngleRadians(const glm::vec3& source, 109 | const glm::vec3& dest) noexcept { 110 | glm::vec3 delta = dest - source; 111 | 112 | os2::math::NormalizeAngle(delta); 113 | 114 | return std::atan2(delta.y, delta.x); 115 | } 116 | 117 | glm::vec3 os2::math::VecTransformMatrix(const glm::vec3& vec, 118 | const glm::mat3x4& mat) noexcept { 119 | return { 120 | vec.x * mat[0][0] + vec.y * mat[0][1] + vec.z * mat[0][2] + mat[0][3], 121 | vec.x * mat[1][0] + vec.y * mat[1][1] + vec.z * mat[1][2] + mat[1][3], 122 | vec.x * mat[2][0] + vec.y * mat[2][1] + vec.z * mat[2][2] + mat[2][3]}; 123 | } 124 | 125 | float os2::math::AbsoluteDotProduct(const glm::vec3& source, 126 | const glm::vec3& rhs) noexcept { 127 | return std::abs(source.x * rhs.x) + std::abs(source.y * rhs.y) + 128 | std::abs(source.z * rhs.z); 129 | } 130 | 131 | template 132 | constexpr auto os2::math::deg2rad(T degrees) noexcept { 133 | return degrees * (std::numbers::pi_v / static_cast(180)); 134 | } 135 | 136 | glm::vec3 os2::math::FromAngle(const glm::vec3& angle) noexcept { 137 | return glm::vec3{std::cos(deg2rad(angle.x)) * std::cos(deg2rad(angle.y)), 138 | std::cos(deg2rad(angle.x)) * std::sin(deg2rad(angle.y)), 139 | -std::sin(deg2rad(angle.x))}; 140 | } 141 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/math.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "classes/vector.hpp" 4 | #include "classes/vmatrix.hpp" 5 | #include "types/quaternion.hpp" 6 | 7 | struct ImVec2; 8 | 9 | namespace os2::math { 10 | bool WorldToScreen(const os2::sdk::Vector& in, ImVec2& out) noexcept; 11 | void TransformAABB(const glm::mat3x4& mat, const glm::vec3& minsIn, 12 | const glm::vec3& maxsIn, glm::vec3& minsOut, 13 | glm::vec3& maxsOut) noexcept; 14 | void UpdateViewMatrix(os2::sdk::VMatrix* pViewMatrix) noexcept; 15 | void ClampAngle(glm::vec3& angle) noexcept; 16 | void NormalizeAngle(glm::vec3& angle) noexcept; 17 | float CalculateFOV(const glm::vec3& source, const glm::vec3& dest) noexcept; 18 | float CalculateAngleRadians(const glm::vec3& source, 19 | const glm::vec3& dest) noexcept; 20 | glm::vec3 VecTransformMatrix(const glm::vec3& vec, 21 | const glm::mat3x4& mat) noexcept; 22 | glm::vec3 ToAngle(const glm::vec3& vec) noexcept; 23 | glm::vec3 CalculateRelativeAngle(const glm::vec3 source, 24 | const glm::vec3 dest, 25 | const glm::vec3& view_angles) noexcept; 26 | float AbsoluteDotProduct(const glm::vec3& source, 27 | const glm::vec3& rhs) noexcept; 28 | template 29 | constexpr auto deg2rad(T degrees) noexcept; 30 | glm::vec3 FromAngle(const glm::vec3& angle) noexcept; 31 | }; // namespace os2::math 32 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/types/bbox_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace os2::sdk { 9 | struct BBox_t { 10 | BBox_t() { Invalidate(); } 11 | 12 | void Invalidate() noexcept { 13 | static constexpr auto MAX_FLOAT = std::numeric_limits::max(); 14 | 15 | m_Mins.x = m_Mins.y = MAX_FLOAT; 16 | m_Maxs.x = m_Maxs.y = -MAX_FLOAT; 17 | 18 | std::fill(std::begin(m_Vertices), std::end(m_Vertices), 19 | ImVec2{-MAX_FLOAT, -MAX_FLOAT}); 20 | } 21 | 22 | ImVec2 m_Mins, m_Maxs; 23 | ImVec2 m_Vertices[8]; 24 | }; 25 | }; // namespace os2::sdk 26 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/math/types/quaternion.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | struct Quaternion { 5 | public: 6 | float x, y, z, w; 7 | }; 8 | }; // namespace os2::sdk 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/schema/schema.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "schema.hpp" 4 | 5 | #include "../interfaces/interfaces.hpp" 6 | 7 | using SchemaKeyValueMap_t = std::unordered_map; 8 | using SchemaTableMap_t = std::unordered_map; 9 | 10 | static bool InitSchemaFieldsForClass(const char* moduleName, 11 | SchemaTableMap_t& tableMap, 12 | const char* className, uint32_t classKey) { 13 | os2::sdk::CSchemaSystemTypeScope* pType = 14 | os2::iface::pSchemaSystem->FindTypeScopeForModule(moduleName); 15 | if (!pType) return false; 16 | 17 | os2::sdk::SchemaClassInfoData_t* pClassInfo = 18 | pType->FindDeclaredClass(className); 19 | if (!pClassInfo) { 20 | tableMap.emplace(classKey, SchemaKeyValueMap_t{}); 21 | 22 | LOG(os2::schema::strings::log_schema_field_not_found.c_str(), className); 23 | return false; 24 | } 25 | 26 | short fieldsSize = pClassInfo->GetFieldsSize(); 27 | os2::sdk::SchemaClassFieldData_t* pFields = pClassInfo->GetFields(); 28 | 29 | auto& keyValueMap = tableMap[classKey]; 30 | keyValueMap.reserve(fieldsSize); 31 | 32 | for (int i = 0; i < fieldsSize; ++i) { 33 | os2::sdk::SchemaClassFieldData_t& field = pFields[i]; 34 | 35 | #ifdef OPENSOURCE2_ENABLE_LOGGING 36 | LOG(os2::schema::strings::log_offset_class.c_str(), className, field.m_name, 37 | field.m_offset); 38 | #endif 39 | 40 | keyValueMap.emplace(hash_32_fnv1a_const(field.m_name), field.m_offset); 41 | } 42 | 43 | LOG(os2::schema::strings::log_schematablemap_fields_count.c_str(), className, 44 | keyValueMap.size()); 45 | return true; 46 | } 47 | 48 | int16_t os2::schema::GetOffset(const char* moduleName, const char* className, 49 | uint32_t classKey, const char* memberName, 50 | uint32_t memberKey) { 51 | static SchemaTableMap_t schemaTableMap; 52 | const auto& tableMapIt = schemaTableMap.find(classKey); 53 | if (tableMapIt == schemaTableMap.cend()) { 54 | if (InitSchemaFieldsForClass(moduleName, schemaTableMap, className, 55 | classKey)) 56 | return GetOffset(moduleName, className, classKey, memberName, memberKey); 57 | 58 | return 0; 59 | } 60 | 61 | const SchemaKeyValueMap_t& tableMap = tableMapIt->second; 62 | if (tableMap.find(memberKey) == tableMap.cend()) { 63 | LOG(strings::log_offset_not_found.c_str(), memberName, className); 64 | return 0; 65 | } 66 | 67 | return tableMap.at(memberKey); 68 | } 69 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/schema/schema.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "../fnv1a/hash_fnv1a_constexpr.hpp" 7 | #include "../utilities/static_string.hpp" 8 | 9 | #define SCHEMA_FIELD_OFFSET(varName, datatable, propName, extra_offset, type) \ 10 | std::add_lvalue_reference_t varName() { \ 11 | static constexpr auto datatable_hash = hash_32_fnv1a_const(datatable); \ 12 | static constexpr auto prop_hash = hash_32_fnv1a_const(propName); \ 13 | \ 14 | static const auto m_offset = os2::schema::GetOffset( \ 15 | CLIENT_DLL.c_str(), datatable, datatable_hash, propName, prop_hash); \ 16 | \ 17 | return *reinterpret_cast>( \ 18 | (uintptr_t)(this) + m_offset + extra_offset); \ 19 | } 20 | 21 | #define SCHEMA_FIELD(varName, datatable, propName, type) \ 22 | SCHEMA_FIELD_OFFSET(varName, datatable, propName, 0, type) 23 | 24 | #define SCHEMA_EXTENDED(varName, moduleName, datatable, propName, type, \ 25 | extra_offset) \ 26 | std::add_lvalue_reference_t varName() const { \ 27 | static constexpr auto datatable_hash = hash_32_fnv1a_const(datatable); \ 28 | static constexpr auto prop_hash = hash_32_fnv1a_const(propName); \ 29 | \ 30 | static const auto m_offset = os2::schema::GetOffset( \ 31 | moduleName.c_str(), datatable, datatable_hash, propName, prop_hash); \ 32 | \ 33 | if (m_offset) \ 34 | return *reinterpret_cast>( \ 35 | (uintptr_t)(this) + m_offset + extra_offset); \ 36 | \ 37 | static type null{}; \ 38 | return null; \ 39 | } 40 | 41 | #define PSCHEMA_FIELD_OFFSET(varName, datatable, propName, extra_offset, type) \ 42 | auto varName() { \ 43 | static constexpr auto datatable_hash = hash_32_fnv1a_const(datatable); \ 44 | static constexpr auto prop_hash = hash_32_fnv1a_const(propName); \ 45 | \ 46 | static const auto m_offset = os2::schema::GetOffset( \ 47 | CLIENT_DLL.c_str(), datatable, datatable_hash, propName, prop_hash); \ 48 | \ 49 | return reinterpret_cast>( \ 50 | (uintptr_t)(this) + m_offset + extra_offset); \ 51 | } 52 | 53 | #define PSCHEMA_FIELD(varName, datatable, propName, type) \ 54 | PSCHEMA_FIELD_OFFSET(varName, datatable, propName, 0, type) 55 | 56 | namespace os2::schema { 57 | namespace strings { 58 | inline const std::string log_schema_field_not_found = os2_string( 59 | "os2::schema::InitSchemaFieldsForClass(): '%s' was not found!\n"); 60 | inline const std::string log_offset_not_found = 61 | os2_string("os2::schema::GetOffset(): '%s' was not found in '%s'!\n"); 62 | inline const std::string log_offset_class = 63 | os2_string("%s::%s found at -> 0x%X\n"); 64 | inline const std::string log_schematablemap_fields_count = 65 | os2_string("schemaTableMap[%s] has %llu fields.\n"); 66 | }; // namespace strings 67 | 68 | int16_t GetOffset(const char* moduleName, const char* className, 69 | uint32_t classKey, const char* memberName, 70 | uint32_t memberKey); 71 | }; // namespace os2::schema 72 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/shaders/CopyPS.hlsl: -------------------------------------------------------------------------------- 1 | // CopyPS.hlsl 2 | Texture2D backBufferTex : register(t0); 3 | SamplerState sampler0 : register(s0); 4 | 5 | float4 main(float2 uv : TEXCOORD0) : SV_TARGET 6 | { 7 | return backBufferTex.Sample(sampler0, uv); 8 | } 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/shaders/gaussian_blur_x.hlsl: -------------------------------------------------------------------------------- 1 | // Shader Model 5.0 2 | 3 | Texture2D tex : register(t0); // Texture 4 | SamplerState texSampler : register(s0); // Sampler state 5 | 6 | cbuffer Constants : register(b0) 7 | { 8 | float texelHeight; 9 | float3 offsets = { 0.0f, 1.3846153846f, 3.2307692308f }; 10 | float3 weights = { 0.2270270270f, 0.3162162162f, 0.0702702703f }; 11 | } 12 | 13 | float4 main(float2 uv : TEXCOORD0) : SV_TARGET 14 | { 15 | float4 color = tex.Sample(texSampler, uv); 16 | color.rgb *= weights[0]; 17 | 18 | for (int i = 1; i < 3; ++i) 19 | { 20 | color.rgb += tex.Sample(texSampler, float2(uv.x, uv.y - texelHeight * offsets[i])).rgb * weights[i]; 21 | color.rgb += tex.Sample(texSampler, float2(uv.x, uv.y + texelHeight * offsets[i])).rgb * weights[i]; 22 | } 23 | 24 | return color; 25 | } 26 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/shaders/gaussian_blur_y.hlsl: -------------------------------------------------------------------------------- 1 | // Shader Model 5.0 2 | 3 | Texture2D tex : register(t0); // Texture 4 | SamplerState texSampler : register(s0); // Sampler state 5 | 6 | cbuffer Constants : register(b0) 7 | { 8 | float texelWidth; 9 | float3 offsets = { 0.0f, 1.3846153846f, 3.2307692308f }; 10 | float3 weights = { 0.2270270270f, 0.3162162162f, 0.0702702703f }; 11 | } 12 | 13 | float4 main(float2 uv : TEXCOORD0) : SV_TARGET 14 | { 15 | float4 color = tex.Sample(texSampler, uv); 16 | color.rgb *= weights[0]; 17 | 18 | for (int i = 1; i < 3; ++i) 19 | { 20 | color.rgb += tex.Sample(texSampler, float2(uv.x - texelWidth * offsets[i], uv.y)).rgb * weights[i]; 21 | color.rgb += tex.Sample(texSampler, float2(uv.x + texelWidth * offsets[i], uv.y)).rgb * weights[i]; 22 | } 23 | 24 | return color; 25 | } 26 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/bitflag.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class BitFlag { 5 | public: 6 | BitFlag() = default; 7 | 8 | explicit BitFlag(const std::uintptr_t flag) : flag_(flag) {} 9 | 10 | __forceinline void add_flag(const std::uintptr_t flag) { flag_ |= flag; } 11 | 12 | [[nodiscard]] __forceinline bool has_flag(const std::uintptr_t flag) const { 13 | return flag_ & flag; 14 | } 15 | 16 | __forceinline void remove_flag(const std::uintptr_t flag) { flag_ &= ~flag; } 17 | 18 | [[nodiscard]] __forceinline std::uintptr_t get_flag() const { return flag_; } 19 | 20 | private: 21 | std::uintptr_t flag_; 22 | }; 23 | }; // namespace os2::sdk 24 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/c_attributecontainer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "econ/c_econitemview.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_AttributeContainer { 7 | public: 8 | PSCHEMA_FIELD(m_Item, "C_AttributeContainer", "m_Item", C_EconItemView); 9 | }; 10 | }; // namespace os2::sdk 11 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/c_baseplayerweapon.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "econ/c_econentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_BasePlayerWeapon : public C_EconEntity { 7 | public: 8 | }; 9 | }; // namespace os2::sdk 10 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/ccsgoinput.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2 { 4 | namespace sdk { 5 | enum { 6 | IN_ATTACK = 1 << 0, 7 | IN_JUMP = 1 << 1, 8 | IN_DUCK = 1 << 2, 9 | IN_FORWARD = 1 << 3, 10 | IN_BACK = 1 << 4, 11 | IN_USE = 1 << 5, 12 | IN_MOVELEFT = 1 << 9, 13 | IN_MOVERIGHT = 1 << 10, 14 | IN_ATTACK2 = 1 << 11, 15 | IN_SCORE = 1 << 16, 16 | IN_BULLRUSH = 1 << 22 17 | }; 18 | 19 | class pb_base { 20 | PAD_CLASS(0x18); 21 | }; 22 | 23 | class CCmdQAngle : public pb_base { 24 | public: 25 | glm::vec3 m_angles; 26 | }; 27 | 28 | class CCmdVector : public pb_base { 29 | public: 30 | glm::vec4 m_vector; 31 | }; 32 | 33 | class CSubTickContainer { 34 | public: 35 | int32_t m_tick_count; 36 | PAD_CLASS(0x4); 37 | void* m_input_history; 38 | }; 39 | 40 | class CUserCmdBase { 41 | public: 42 | PAD_CLASS(0x40); 43 | CCmdQAngle* m_viewangles; 44 | int m_command_number; 45 | int m_tick_count; 46 | float m_forwardmove; 47 | float m_rightmove; 48 | float m_upmove; 49 | }; 50 | 51 | class CUserCmd { 52 | public: 53 | PAD_CLASS(0x20); 54 | CSubTickContainer m_sub_tick_container; 55 | CUserCmdBase* m_base_cmd; 56 | int m_start_history_index_attack1; 57 | int m_start_history_index_attack2; 58 | int m_start_history_index_attack3; 59 | PAD_CLASS(0x8); 60 | uint64_t m_buttons; 61 | uint64_t m_buttons_changed; 62 | uint64_t m_buttons_scroll; 63 | 64 | PAD_CLASS(0x8); 65 | }; 66 | 67 | class CCSGOInput { 68 | public: 69 | void* table; 70 | PAD_CLASS(0x248); 71 | CUserCmd m_commands[150]; 72 | PAD_CLASS(0x1); 73 | bool m_in_third_person; 74 | PAD_CLASS(0x22); 75 | int32_t m_sequence_number; 76 | 77 | auto get_user_cmd() { return &m_commands[m_sequence_number % 150]; } 78 | }; 79 | }; // namespace sdk 80 | }; // namespace os2 81 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cgameentitysystem.cpp: -------------------------------------------------------------------------------- 1 | #include "cgameentitysystem.hpp" 2 | 3 | #include "../../interfaces/interfaces.hpp" 4 | 5 | using namespace os2::sdk; 6 | 7 | CGameEntitySystem* CGameEntitySystem::GetInstance() { 8 | if (!os2::iface::pGameResourceService) return nullptr; 9 | 10 | return os2::iface::pGameResourceService->GetGameEntitySystem(); 11 | } 12 | 13 | CCSPlayerController* CGameEntitySystem::GetLocalPlayerController() { 14 | if (!os2::fn::GetLocalPlayerController) return nullptr; 15 | 16 | return os2::fn::GetLocalPlayerController(-1); 17 | } 18 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cgameentitysystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../memory/memory.hpp" 4 | #include "../../virtual/virtual.hpp" 5 | 6 | #include "entity/c_baseviewmodel.hpp" 7 | #include "entity/c_chicken.hpp" 8 | #include "entity/c_plantedc4.hpp" 9 | #include "entity/ccsplayercontroller.hpp" 10 | 11 | namespace os2::sdk { 12 | class CGameEntitySystem { 13 | public: 14 | static CGameEntitySystem* GetInstance(); 15 | static CCSPlayerController* GetLocalPlayerController(); 16 | 17 | template 18 | T* GetBaseEntity(int index) { 19 | if (!os2::fn::GetBaseEntity) return nullptr; 20 | 21 | return (T*)(os2::fn::GetBaseEntity(this, index)); 22 | } 23 | 24 | int GetHighestEntityIndex() { 25 | int highestIdx = -1; 26 | 27 | if (!os2::fn::GetHighestEntityIndex) return highestIdx; 28 | 29 | os2::fn::GetHighestEntityIndex(this, &highestIdx); 30 | 31 | return highestIdx; 32 | } 33 | }; 34 | }; // namespace os2::sdk 35 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cgameevent.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | class CCSPlayerController; 7 | 8 | class CGameEvent { 9 | public: 10 | auto GetName() { return CALL_VIRTUAL(const char*, 1, this); } 11 | 12 | auto GetPlayerController(const char* keyName) { 13 | // I don't know the real name of this function. It calls some function 14 | // with the value returned by GetInt(). 15 | return CALL_VIRTUAL(CCSPlayerController*, 16, this, keyName); 16 | } 17 | 18 | auto SetString(const char* keyName, const char* value) { 19 | return CALL_VIRTUAL(void, 24, this, keyName, value); 20 | } 21 | }; 22 | }; // namespace os2::sdk 23 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cgameeventmanager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class CGameEventManager { 5 | public: 6 | bool add_listener(os2::sdk::IGameEventListener2* listener, const char* name, 7 | const bool server_side) { 8 | return CALL_VIRTUAL(bool, 3, this, listener, name, server_side); 9 | } 10 | 11 | void remove_listener(os2::sdk::IGameEventListener2* listener) { 12 | CALL_VIRTUAL(void, 5, this, listener); 13 | } 14 | }; 15 | }; // namespace os2::sdk 16 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/chandle.cpp: -------------------------------------------------------------------------------- 1 | #include "chandle.hpp" 2 | 3 | #include "../../interfaces/interfaces.hpp" 4 | 5 | os2::sdk::C_BaseEntity* os2::sdk::CHandle::GetBaseEntity() const { 6 | os2::sdk::CGameEntitySystem* pEntitySystem = os2::sdk::CGameEntitySystem::GetInstance(); 7 | if (!pEntitySystem) return nullptr; 8 | 9 | return pEntitySystem->GetBaseEntity(GetEntryIndex()); 10 | } 11 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/chandle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace os2::sdk { 6 | #define INVALID_EHANDLE_INDEX 0xFFFFFFFF 7 | #define ENT_ENTRY_MASK 0x7fff 8 | 9 | class C_BaseEntity; 10 | 11 | class CHandle { 12 | C_BaseEntity* GetBaseEntity() const; 13 | 14 | public: 15 | bool operator==(CHandle rhs) const { return m_Index == rhs.m_Index; } 16 | bool IsValid() const { return m_Index != INVALID_EHANDLE_INDEX; } 17 | 18 | int GetEntryIndex() const { return m_Index & ENT_ENTRY_MASK; } 19 | template 20 | T* Get() const { 21 | return reinterpret_cast(GetBaseEntity()); 22 | } 23 | 24 | uint32_t m_Index; 25 | }; 26 | }; // namespace os2::sdk 27 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cheapmemalloc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | class CHeapMemAlloc { 7 | public: 8 | template 9 | auto Alloc(size_t nSize) { 10 | return CALL_VIRTUAL(T, 2, this, nSize); 11 | } 12 | 13 | template 14 | auto Realloc(T pMem, size_t nSize) { 15 | return CALL_VIRTUAL(T, 4, this, pMem, nSize); 16 | } 17 | 18 | auto Free(void* pMem) { return CALL_VIRTUAL(void, 6, this, pMem); } 19 | } inline* g_pHeapMemAlloc; 20 | }; // namespace os2::sdk 21 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cmaterial2.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class CMaterial2 { 5 | public: 6 | __forceinline const char* get_name() { 7 | return CALL_VIRTUAL(const char*, 0, this); 8 | } 9 | 10 | __forceinline const char* get_name_with_module() { 11 | return CALL_VIRTUAL(const char*, 1, this); 12 | } 13 | }; 14 | }; // namespace os2::sdk 15 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cnetworkutlvectorbase.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | template 5 | class CNetworkUtlVectorBase { 6 | public: 7 | auto begin() const { return m_data; } 8 | auto end() const { return m_data + m_size; } 9 | 10 | int m_size; 11 | char pad0[0x4]; // no idea 12 | T* m_data; 13 | }; 14 | }; // namespace os2::sdk 15 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cstronghandle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | struct ResourceBinding_t { 5 | void* data; 6 | }; 7 | 8 | template 9 | class CStrongHandle { 10 | public: 11 | explicit operator T*() const { 12 | return is_valid() ? reinterpret_cast(binding_->data) : nullptr; 13 | } 14 | 15 | T* operator->() const { 16 | return is_valid() ? reinterpret_cast(binding_->data) : nullptr; 17 | } 18 | 19 | [[nodiscard]] bool is_valid() const { return binding_->data != nullptr; } 20 | 21 | private: 22 | const ResourceBinding_t* binding_; 23 | }; 24 | }; 25 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cutlmap.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace os2::sdk { 6 | template 7 | class CUtlMap { 8 | public: 9 | struct Node_t { 10 | int m_left; 11 | int m_right; 12 | int m_parent; 13 | int m_tag; 14 | K m_key; 15 | V m_value; 16 | }; 17 | 18 | auto begin() const { return m_data; } 19 | auto end() const { return m_data + m_size; } 20 | 21 | std::optional FindByKey(K key) const { 22 | int current = m_root; 23 | while (current != -1) { 24 | const Node_t& element = m_data[current]; 25 | if (element.m_key < key) 26 | current = element.m_right; 27 | else if (element.m_key > key) 28 | current = element.m_left; 29 | else 30 | return element.m_value; 31 | } 32 | return {}; 33 | } 34 | 35 | char pad0[0x8]; // no idea 36 | Node_t* m_data; 37 | char pad1[0x8]; // no idea 38 | int m_root; 39 | int m_size; 40 | char pad2[0x8]; // no idea 41 | }; 42 | }; // namespace os2::sdk 43 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cutlsymbollarge.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | using CUtlSymLargeId = std::int32_t*; 5 | 6 | class CUtlSymbolLarge { 7 | inline static const CUtlSymLargeId UTL_INVALID_SYMBOL_LARGE = 8 | reinterpret_cast(-1); 9 | 10 | public: 11 | CUtlSymbolLarge() { id_ = UTL_INVALID_SYMBOL_LARGE; } 12 | 13 | explicit CUtlSymbolLarge(CUtlSymLargeId id) { id_ = id; } 14 | 15 | CUtlSymbolLarge(CUtlSymbolLarge const& sym) { id_ = sym.id_; } 16 | 17 | CUtlSymbolLarge& operator=(CUtlSymbolLarge const& src) { 18 | id_ = src.id_; 19 | 20 | return *this; 21 | } 22 | 23 | bool operator==(CUtlSymbolLarge const& src) const { return id_ == src.id_; } 24 | 25 | bool operator==(CUtlSymLargeId const& src) const { return id_ == src; } 26 | 27 | bool operator!=(CUtlSymbolLarge const& src) const { return id_ != src.id_; } 28 | 29 | bool operator!=(CUtlSymLargeId const& src) const { return id_ != src; } 30 | 31 | explicit operator CUtlSymLargeId() const { return id_; } 32 | 33 | [[nodiscard]] const char* get_string() const { 34 | if (id_ == UTL_INVALID_SYMBOL_LARGE) return ""; 35 | 36 | return string_; 37 | } 38 | 39 | [[nodiscard]] bool is_valid() const { 40 | return id_ != UTL_INVALID_SYMBOL_LARGE; 41 | } 42 | 43 | private: 44 | union { 45 | CUtlSymLargeId id_; 46 | const char* string_; 47 | }; 48 | }; 49 | }; // namespace os2::sdk 50 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/cutlvector.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cheapmemalloc.hpp" 4 | #include "cutlmap.hpp" 5 | 6 | namespace os2::sdk { 7 | template 8 | class CUtlVector { 9 | public: 10 | auto begin() const { return m_data; } 11 | auto end() const { return m_data + m_size; } 12 | 13 | auto At(int i) const { return m_data[i]; } 14 | auto AtPtr(int i) const { return m_data + i; } 15 | 16 | bool Exists(T val) const { 17 | for (const auto& it : *this) 18 | if (it == val) return true; 19 | return false; 20 | } 21 | bool IsEmpty() const { return m_size == 0; } 22 | 23 | int m_size; 24 | char pad0[0x4]; // no idea 25 | T* m_data; 26 | char pad1[0x8]; // no idea 27 | }; 28 | }; // namespace os2::sdk 29 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/c_econentity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../c_attributecontainer.hpp" 4 | #include "../entity/c_basemodelentity.hpp" 5 | 6 | namespace os2::sdk { 7 | class C_EconEntity : public C_BaseModelEntity { 8 | public: 9 | PSCHEMA_FIELD(m_AttributeManager, "C_EconEntity", "m_AttributeManager", 10 | C_AttributeContainer); 11 | SCHEMA_FIELD(m_OriginalOwnerXuidLow, "C_EconEntity", "m_OriginalOwnerXuidLow", 12 | uint32_t); 13 | SCHEMA_FIELD(m_OriginalOwnerXuidHigh, "C_EconEntity", 14 | "m_OriginalOwnerXuidHigh", uint32_t); 15 | 16 | uint64_t GetOriginalOwnerXuid() { 17 | return ((uint64_t)(m_OriginalOwnerXuidHigh()) << 32) | 18 | m_OriginalOwnerXuidLow(); 19 | } 20 | }; 21 | }; // namespace os2::sdk 22 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/c_econitemview.cpp: -------------------------------------------------------------------------------- 1 | #include "c_econitemview.hpp" 2 | 3 | #include "../../../memory/memory.hpp" 4 | 5 | os2::sdk::CEconItem* os2::sdk::C_EconItemView::GetSOCData() { 6 | /** 7 | * @TODO 8 | * ... later =] 9 | * 10 | * CCSPlayerInventory* pInventory = CCSPlayerInventory::GetInstance(); 11 | if (!pInventory) return nullptr; 12 | 13 | return pInventory->GetSOCDataForItem(m_iItemID()); 14 | * 15 | */ 16 | return nullptr; 17 | } 18 | 19 | os2::sdk::CCSWeaponBaseVData* os2::sdk::C_EconItemView::GetWeaponInfo() { 20 | if (!os2::fn::GetWeaponData) return nullptr; 21 | return os2::fn::GetWeaponData(this); 22 | } 23 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/c_econitemview.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../schema/schema.hpp" 4 | 5 | #include "./ceconitemdefinition.hpp" 6 | 7 | namespace os2::sdk { 8 | enum class CSWeaponType { 9 | Knife = 0, 10 | Pistol, 11 | SubMachinegun, 12 | Rifle, 13 | Shotgun, 14 | SniperRifle, 15 | Machinegun, 16 | C4, 17 | Placeholder, 18 | Grenade, 19 | Unknown, 20 | StackableItem, 21 | Fists, 22 | BreachCharge, 23 | BumpMine, 24 | Tablet, 25 | Melee 26 | }; 27 | 28 | class CCSWeaponBaseVData { 29 | public: 30 | SCHEMA_FIELD(damage, "CCSWeaponBaseVData", "m_nDamage", 31 | int32_t); // Offset: 3376 32 | SCHEMA_FIELD(headshotMultiplier, "CCSWeaponBaseVData", 33 | "m_flHeadshotMultiplier", float); // Offset: 3380 34 | SCHEMA_FIELD(armorRatio, "CCSWeaponBaseVData", "m_flArmorRatio", 35 | float); // Offset: 3384 36 | SCHEMA_FIELD(penetration, "CCSWeaponBaseVData", "m_flPenetration", 37 | float); // Offset: 3388 38 | SCHEMA_FIELD(range, "CCSWeaponBaseVData", "m_flRange", 39 | float); // Offset: 3392 40 | SCHEMA_FIELD(rangeModifier, "CCSWeaponBaseVData", "m_flRangeModifier", 41 | float); // Offset: 3396 42 | SCHEMA_FIELD(bulletsInClip, "CBasePlayerWeaponVData", "m_nNumBullets", 43 | int32_t); // Offset: 268 44 | SCHEMA_FIELD(type, "CCSWeaponBaseVData", "m_WeaponType", 45 | CSWeaponType); // Offset: 576 46 | }; 47 | 48 | class CEconItem; 49 | 50 | class C_EconItemView { 51 | public: 52 | CEconItem* GetSOCData(); 53 | CCSWeaponBaseVData* GetWeaponInfo(); 54 | 55 | auto GetCustomPaintKitIndex() { return CALL_VIRTUAL(int, 2, this); } 56 | auto GetStaticData() { return CALL_VIRTUAL(CEconItemDefinition*, 13, this); } 57 | 58 | SCHEMA_FIELD(m_iItemDefinitionIndex, "C_EconItemView", 59 | "m_iItemDefinitionIndex", uint16_t); 60 | SCHEMA_FIELD(m_iItemID, "C_EconItemView", "m_iItemID", uint64_t); 61 | SCHEMA_FIELD(m_iItemIDLow, "C_EconItemView", "m_iItemIDLow", uint32_t); 62 | SCHEMA_FIELD(m_iItemIDHigh, "C_EconItemView", "m_iItemIDHigh", uint32_t); 63 | SCHEMA_FIELD(m_iAccountID, "C_EconItemView", "m_iAccountID", uint32_t); 64 | }; 65 | }; // namespace os2::sdk 66 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitem.cpp: -------------------------------------------------------------------------------- 1 | #include "ceconitem.hpp" 2 | 3 | #include "../../../memory/memory.hpp" 4 | #include "../../../interfaces/interfaces.hpp" 5 | 6 | using namespace os2::sdk; 7 | 8 | void CEconItem::SetDynamicAttributeValue(int index, void* value) { 9 | CEconItemSchema* pItemSchema = 10 | os2::iface::pClient->GetEconItemSystem()->GetEconItemSchema(); 11 | if (!pItemSchema) return; 12 | 13 | void* pAttributeDefinitionInterface = 14 | pItemSchema->GetAttributeDefinitionInterface(index); 15 | if (!pAttributeDefinitionInterface) return; 16 | 17 | if (!os2::fn::SetDynamicAttributeValueUint) return; 18 | os2::fn::SetDynamicAttributeValueUint( 19 | this, pAttributeDefinitionInterface, 20 | value); 21 | } 22 | 23 | void CEconItem::SetDynamicAttributeValueString(int index, const char* value) { 24 | // CS2FIXME: Function got inlined and cannot be sigscanned. 25 | } 26 | 27 | CEconItem* CEconItem::CreateInstance() { 28 | if (!os2::fn::CreateSharedObjectSubclassEconItem) return nullptr; 29 | return os2::fn::CreateSharedObjectSubclassEconItem(); 30 | } 31 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | class CSharedObject; 7 | 8 | class CEconItem { 9 | void SetDynamicAttributeValue(int index, void* value); 10 | void SetDynamicAttributeValueString(int index, const char* value); 11 | 12 | public: 13 | static CEconItem* CreateInstance(); 14 | 15 | auto Destruct() { return CALL_VIRTUAL(void, 1, this, true); } 16 | 17 | void SetPaintKit(float kit) { SetDynamicAttributeValue(6, &kit); } 18 | void SetPaintSeed(float seed) { SetDynamicAttributeValue(7, &seed); } 19 | void SetPaintWear(float wear) { SetDynamicAttributeValue(8, &wear); } 20 | void SetStatTrak(int count) { SetDynamicAttributeValue(80, &count); } 21 | void SetStatTrakType(int type) { SetDynamicAttributeValue(81, &type); } 22 | void SetCustomName(const char* pName) { 23 | SetDynamicAttributeValueString(111, pName); 24 | } 25 | 26 | char pad0[0x10]; // 2 vtables 27 | uint64_t m_ulID; 28 | uint64_t m_ulOriginalID; 29 | void* m_pCustomDataOptimizedObject; 30 | uint32_t m_unAccountID; 31 | uint32_t m_unInventory; 32 | uint16_t m_unDefIndex; 33 | uint16_t m_unOrigin : 5; 34 | uint16_t m_nQuality : 4; 35 | uint16_t m_unLevel : 2; 36 | uint16_t m_nRarity : 4; 37 | uint16_t m_dirtybitInUse : 1; 38 | int16_t m_iItemSet; 39 | int m_bSOUpdateFrame; 40 | uint8_t m_unFlags; 41 | }; 42 | }; // namespace os2::sdk 43 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitemdefinition.cpp: -------------------------------------------------------------------------------- 1 | #include "ceconitemdefinition.hpp" 2 | 3 | #include "../../../fnv1a/hash_fnv1a_constexpr.hpp" 4 | 5 | using namespace os2::sdk; 6 | 7 | bool CEconItemDefinition::IsWeapon() { 8 | // Every gun supports at least 4 stickers. 9 | return GetStickersSupportedCount() >= 4; 10 | } 11 | 12 | bool CEconItemDefinition::IsKnife(bool excludeDefault) { 13 | static constexpr auto CSGO_Type_Knife = 14 | hash_32_fnv1a_const("#CSGO_Type_Knife"); 15 | 16 | if (hash_32_fnv1a_const(m_pszItemTypeName) != CSGO_Type_Knife) return false; 17 | return excludeDefault ? m_nDefIndex >= 500 : true; 18 | } 19 | 20 | bool CEconItemDefinition::IsGlove(bool excludeDefault) { 21 | static constexpr auto Type_Hands = hash_32_fnv1a_const("#Type_Hands"); 22 | 23 | if (hash_32_fnv1a_const(m_pszItemTypeName) != Type_Hands) return false; 24 | const bool defaultGlove = m_nDefIndex == 5028 || m_nDefIndex == 5029; 25 | 26 | return excludeDefault ? !defaultGlove : true; 27 | } 28 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitemdefinition.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../virtual/virtual.hpp" 4 | #include "../cutlvector.hpp" 5 | 6 | namespace os2::sdk { 7 | class CEconItemDefinition { 8 | public: 9 | bool IsWeapon(); 10 | bool IsKnife(bool excludeDefault); 11 | bool IsGlove(bool excludeDefault); 12 | 13 | auto GetModelName() { 14 | return *reinterpret_cast((uintptr_t)(this) + 0xD8); 15 | } 16 | 17 | auto GetStickersSupportedCount() { 18 | return *reinterpret_cast((uintptr_t)(this) + 0x100); 19 | } 20 | 21 | auto GetSimpleWeaponName() { 22 | return *reinterpret_cast((uintptr_t)(this) + 0x210); 23 | } 24 | 25 | auto GetLoadoutSlot() { 26 | return *reinterpret_cast((uintptr_t)(this) + 0x2E8); 27 | } 28 | 29 | char pad0[0x8]; // vtable 30 | void* m_pKVItem; 31 | uint16_t m_nDefIndex; 32 | CUtlVector m_nAssociatedItemsDefIndexes; 33 | bool m_bEnabled; 34 | const char* m_szPrefab; 35 | uint8_t m_unMinItemLevel; 36 | uint8_t m_unMaxItemLevel; 37 | uint8_t m_nItemRarity; 38 | uint8_t m_nItemQuality; 39 | uint8_t m_nForcedItemQuality; 40 | uint8_t m_nDefaultDropItemQuality; 41 | uint8_t m_nDefaultDropQuantity; 42 | CUtlVector m_vecStaticAttributes; 43 | uint8_t m_nPopularitySeed; 44 | void* m_pPortraitsKV; 45 | const char* m_pszItemBaseName; 46 | bool m_bProperName; 47 | const char* m_pszItemTypeName; 48 | uint32_t m_unItemTypeID; 49 | const char* m_pszItemDesc; 50 | }; 51 | }; // namespace os2::sdk 52 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitemschema.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../memory/memory.hpp" 2 | 3 | #include "ceconitemschema.hpp" 4 | 5 | bool os2::sdk::CPaintKit::UsesLegacyModel() { 6 | if (!this || !os2::fn::IsPaintKitUsingLegacyModel) return false; 7 | return os2::fn::IsPaintKitUsingLegacyModel(this->sName); 8 | } 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitemschema.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../virtual/virtual.hpp" 4 | #include "../cutlmap.hpp" 5 | 6 | namespace os2::sdk { 7 | class CEconItemDefinition; 8 | 9 | inline constexpr uint64_t Helper_GetAlternateIconKeyForWeaponPaintWearItem( 10 | uint16_t nDefIdx, uint32_t nPaintId, uint32_t nWear) { 11 | return (nDefIdx << 16) + (nPaintId << 2) + nWear; 12 | } 13 | 14 | struct AlternateIconData_t { 15 | const char* sSimpleName; 16 | const char* sLargeSimpleName; 17 | 18 | private: 19 | char pad0[0x8]; // no idea 20 | char pad1[0x8]; // no idea 21 | char pad2[0x8]; // no idea 22 | char pad3[0x8]; // no idea 23 | }; 24 | 25 | class CPaintKit { 26 | public: 27 | bool UsesLegacyModel(); 28 | 29 | int nID; 30 | const char* sName; 31 | const char* sDescriptionString; 32 | const char* sDescriptionTag; 33 | char pad0[0x8]; // no idea 34 | char pad1[0x8]; // no idea 35 | char pad2[0x8]; // no idea 36 | char pad3[0x8]; // no idea 37 | char pad4[0x4]; // no idea 38 | int nRarity; 39 | }; 40 | 41 | class CEconItemSchema { 42 | public: 43 | auto GetAttributeDefinitionInterface(int iAttribIndex) { 44 | return CALL_VIRTUAL(void*, 27, this, iAttribIndex); 45 | } 46 | 47 | auto& GetSortedItemDefinitionMap() { 48 | return *reinterpret_cast*>( 49 | (uintptr_t)(this) + 0x120); 50 | } 51 | 52 | auto& GetAlternateIconsMap() { 53 | return *reinterpret_cast*>( 54 | (uintptr_t)(this) + 0x270); 55 | } 56 | 57 | auto& GetPaintKits() { 58 | return *reinterpret_cast*>((uintptr_t)(this) + 59 | 0x2E8); 60 | } 61 | }; 62 | }; // namespace os2::sdk 63 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/econ/ceconitemsystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ceconitemschema.hpp" 4 | 5 | namespace os2::sdk { 6 | class CEconItemSystem { 7 | public: 8 | auto GetEconItemSchema() { 9 | return *reinterpret_cast((uintptr_t)(this) + 0x8); 10 | } 11 | }; 12 | }; // namespace os2::sdk 13 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/bones/cbonesystem.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../../memory/memory.hpp" 2 | 3 | #include "cbonesystem.hpp" 4 | 5 | using namespace os2::sdk; 6 | 7 | BitFlag CModel::GetBoneFlags(const std::int32_t index) { 8 | using Fn = std::int32_t(__fastcall*)(CModel*, std::int32_t); 9 | 10 | static auto fn = os2::fn::GetBoneFlags; 11 | 12 | if (fn == nullptr) return {}; 13 | 14 | return BitFlag(fn(this, index)); 15 | } 16 | 17 | std::int32_t CModel::GetBoneParent(const std::int32_t index) { 18 | using Fn = std::int32_t(__fastcall*)(CModel*, std::int32_t); 19 | 20 | static auto fn = os2::fn::GetBoneParent; 21 | 22 | if (fn == nullptr) return {}; 23 | 24 | return fn(this, index); 25 | } 26 | 27 | const char* CModel::GetBoneName(const std::int32_t index) { 28 | using Fn = const char*(__fastcall*)(CModel*, std::int32_t); 29 | 30 | static auto fn = os2::fn::GetBoneName; 31 | 32 | if (fn == nullptr) return ""; 33 | 34 | return fn(this, index); 35 | } 36 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/bones/cbonesystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../cstronghandle.hpp" 6 | #include "../../cutlsymbollarge.hpp" 7 | 8 | #include 9 | #include 10 | 11 | namespace os2::sdk { 12 | enum EBoneFlags : uint32_t { 13 | FLAG_NO_BONE_FLAGS = 0x0, 14 | FLAG_BONEFLEXDRIVER = 0x4, 15 | FLAG_CLOTH = 0x8, 16 | FLAG_PHYSICS = 0x10, 17 | FLAG_ATTACHMENT = 0x20, 18 | FLAG_ANIMATION = 0x40, 19 | FLAG_MESH = 0x80, 20 | FLAG_HITBOX = 0x100, 21 | FLAG_BONE_USED_BY_VERTEX_LOD0 = 0x400, 22 | FLAG_BONE_USED_BY_VERTEX_LOD1 = 0x800, 23 | FLAG_BONE_USED_BY_VERTEX_LOD2 = 0x1000, 24 | FLAG_BONE_USED_BY_VERTEX_LOD3 = 0x2000, 25 | FLAG_BONE_USED_BY_VERTEX_LOD4 = 0x4000, 26 | FLAG_BONE_USED_BY_VERTEX_LOD5 = 0x8000, 27 | FLAG_BONE_USED_BY_VERTEX_LOD6 = 0x10000, 28 | FLAG_BONE_USED_BY_VERTEX_LOD7 = 0x20000, 29 | FLAG_BONE_MERGE_READ = 0x40000, 30 | FLAG_BONE_MERGE_WRITE = 0x80000, 31 | FLAG_ALL_BONE_FLAGS = 0xfffff, 32 | BLEND_PREALIGNED = 0x100000, 33 | FLAG_RIGIDLENGTH = 0x200000, 34 | FLAG_PROCEDURAL = 0x400000, 35 | }; 36 | 37 | struct alignas(16) CBoneData { 38 | glm::vec3 position; 39 | float scale; 40 | glm::vec4 rotation; 41 | }; 42 | 43 | class CModel { 44 | public: 45 | BitFlag GetBoneFlags(std::int32_t index); 46 | 47 | std::int32_t GetBoneParent(std::int32_t index); 48 | 49 | const char* GetBoneName(std::int32_t index); 50 | 51 | public: 52 | std::uint8_t padding_0[0x170]; 53 | std::int32_t BoneCount; 54 | }; 55 | 56 | class CModelState { 57 | public: 58 | std::uint8_t padding_0[0x80]; 59 | CBoneData* bones; 60 | std::uint8_t padding_1[0x18]; 61 | CStrongHandle modelHandle; 62 | CUtlSymbolLarge modelName; 63 | }; 64 | 65 | class CSkeletonInstance : public CGameSceneNode { 66 | public: 67 | SCHEMA_FIELD(m_modelState, "CSkeletonInstance", "m_modelState", CModelState); 68 | SCHEMA_FIELD(m_nHitboxSet, "CSkeletonInstance", "m_nHitboxSet", std::uint8_t); 69 | }; 70 | }; // namespace os2::sdk 71 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_baseentity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ccollisionproperty.hpp" 4 | #include "centityinstance.hpp" 5 | #include "cgamescenenode.hpp" 6 | #include "hitbox/hitbox.hpp" 7 | 8 | #include "../bitflag.hpp" 9 | #include "../.././../math/types/bbox_t.hpp" 10 | 11 | namespace os2::sdk { 12 | class C_BaseEntity : public CEntityInstance { 13 | public: 14 | bool IsBasePlayerController(); 15 | bool IsBasePlayerWeapon(); 16 | bool IsChicken(); 17 | bool IsViewModel(); 18 | bool IsPlantedC4(); 19 | bool IsPointCamera(); 20 | 21 | glm::vec3 GetOrigin(); 22 | bool CalculateBBoxByCollision(BBox_t& out); 23 | bool CalculateBBoxByHitbox(BBox_t& out); 24 | bool ComputeHitboxSurroundingBox(Vector& mins, Vector& maxs); 25 | float DistanceToSquared(C_BaseEntity* pEntity); 26 | 27 | bool GetBonePosition(const std::int32_t boneIndex, glm::vec3& bonePosition); 28 | 29 | CHitBoxSet* GetHitboxSet(int i); 30 | int HitboxToWorldTransforms(CHitBoxSet* hitBoxSet, 31 | CTransform* hitboxToWorld); 32 | 33 | SCHEMA_FIELD(m_pGameSceneNode, "C_BaseEntity", "m_pGameSceneNode", 34 | CGameSceneNode*); 35 | SCHEMA_FIELD(m_pCollision, "C_BaseEntity", "m_pCollision", 36 | CCollisionProperty*); 37 | SCHEMA_FIELD(m_iTeamNum, "C_BaseEntity", "m_iTeamNum", uint8_t); 38 | SCHEMA_FIELD(m_hOwnerEntity, "C_BaseEntity", "m_hOwnerEntity", CHandle); 39 | SCHEMA_FIELD(m_fFlags, "C_BaseEntity", "m_fFlags", BitFlag); 40 | SCHEMA_FIELD(m_vecVelocity, "C_BaseEntity", "m_vecVelocity", Vector); 41 | 42 | [[nodiscard]] bool OnGround() noexcept { 43 | return (m_fFlags().has_flag(1)) != 0; 44 | } 45 | }; 46 | }; // namespace os2::sdk 47 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_basemodelentity.cpp: -------------------------------------------------------------------------------- 1 | #include "c_basemodelentity.hpp" 2 | 3 | #include "../../../memory/memory.hpp" 4 | 5 | void os2::sdk::C_BaseModelEntity::SetModel(const char* name) { 6 | if (!os2::fn::SetModel) return; 7 | os2::fn::SetModel(this, name); 8 | } 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_basemodelentity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_baseentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_BaseModelEntity : public C_BaseEntity { 7 | public: 8 | void SetModel(const char* name); 9 | 10 | SCHEMA_FIELD(m_vecViewOffset, "C_BaseModelEntity", "m_vecViewOffset", 11 | glm::vec3); 12 | }; 13 | }; // namespace os2::sdk 14 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_baseplayerpawn.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_basemodelentity.hpp" 4 | #include "cplayer_weaponservices.hpp" 5 | #include "cplayer_cameraservices.hpp" 6 | 7 | namespace os2::sdk { 8 | class C_BasePlayerPawn : public C_BaseModelEntity { 9 | public: 10 | SCHEMA_FIELD(m_hController, "C_BasePlayerPawn", "m_hController", CHandle); 11 | SCHEMA_FIELD(m_pWeaponServices, "C_BasePlayerPawn", "m_pWeaponServices", 12 | CPlayer_WeaponServices*); 13 | SCHEMA_FIELD(m_pCameraServices, "C_BasePlayerPawn", "m_pCameraServices", 14 | CPlayer_CameraServices*); 15 | }; 16 | }; // namespace os2::sdk 17 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_baseplayerweapon.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../econ/c_econentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_BasePlayerWeapon : public C_EconEntity { 7 | public: 8 | SCHEMA_FIELD(m_nNextPrimaryAttackTick, "C_BasePlayerWeapon", 9 | "m_nNextPrimaryAttackTick", int) 10 | }; 11 | }; // namespace os2::sdk 12 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_baseviewmodel.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_basemodelentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_BaseViewModel : public C_BaseModelEntity { 7 | public: 8 | SCHEMA_FIELD(m_hWeapon, "C_BaseViewModel", "m_hWeapon", CHandle); 9 | }; 10 | }; // namespace os2::sdk 11 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_chicken.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../schema/schema.hpp" 4 | #include "../chandle.hpp" 5 | 6 | #include "c_basemodelentity.hpp" 7 | 8 | namespace os2::sdk { 9 | class C_Chicken : public C_BaseModelEntity { 10 | public: 11 | SCHEMA_FIELD(m_leader, "C_Chicken", "m_leader", CHandle); 12 | }; 13 | }; // namespace os2::sdk 14 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_csplayerpawn.cpp: -------------------------------------------------------------------------------- 1 | #include "c_csplayerpawn.hpp" 2 | 3 | #include "../../../interfaces/interfaces.hpp" 4 | #include "../../../memory/memory.hpp" 5 | 6 | bool os2::sdk::C_CSPlayerPawn::IsEnemyWithTeam(int team) { 7 | static ConVar* mp_teammates_are_enemies = 8 | os2::iface::pCvar->FindVarByName("mp_teammates_are_enemies"); 9 | 10 | os2::sdk::CCSPlayerController* pPlayerController = 11 | m_hController().Get(); 12 | 13 | if (pPlayerController && pPlayerController->m_bIsLocalPlayerController()) 14 | return false; 15 | 16 | return mp_teammates_are_enemies->GetValue() ? true 17 | : m_iTeamNum() != team; 18 | } 19 | 20 | bool os2::sdk::C_CSPlayerPawn::IsDormant() { 21 | os2::sdk::CGameSceneNode* game_scene_node = m_pGameSceneNode(); 22 | 23 | if (game_scene_node == nullptr) return false; 24 | 25 | return game_scene_node->m_bDormant(); 26 | } 27 | 28 | std::uint16_t os2::sdk::C_CSPlayerPawn::GetCollisionMask() { 29 | if (this && m_pCollision()) 30 | return m_pCollision()->CollisionMask(); // Collision + 0x38 31 | return 0; 32 | } 33 | 34 | std::uint32_t os2::sdk::C_CSPlayerPawn::GetOwnerHandle() { 35 | std::uint32_t Result = -1; 36 | if (this && m_pCollision() && !(m_pCollision()->m_solidFlags() & 4)) { 37 | Result = this->m_hOwnerEntity().m_Index; 38 | } 39 | return Result; 40 | } 41 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_csplayerpawn.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_csplayerpawnbase.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_CSPlayerPawn : public C_CSPlayerPawnBase { 7 | public: 8 | SCHEMA_FIELD(m_aimPunchCache, "C_CSPlayerPawn", "m_aimPunchCache", 9 | CUtlVector); 10 | SCHEMA_FIELD(m_szLastPlaceName, "C_CSPlayerPawn", "m_szLastPlaceName", 11 | char[18]); 12 | 13 | bool IsEnemyWithTeam(int team); 14 | 15 | [[nodiscard]] bool IsDormant(); 16 | 17 | std::uint16_t GetCollisionMask(); 18 | 19 | std::uint32_t GetOwnerHandle(); 20 | 21 | __forceinline glm::vec3 GetEyePosition() { 22 | return this->m_pGameSceneNode()->m_vecOrigin() + this->m_vecViewOffset(); 23 | } 24 | 25 | __forceinline glm::vec3 GetEyeAngles() { 26 | glm::vec3 eye_position; 27 | 28 | CALL_VIRTUAL(std::uint64_t, 160, this, &eye_position); 29 | 30 | return eye_position; 31 | } 32 | }; 33 | }; // namespace os2::sdk 34 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_csplayerpawnbase.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_baseplayerpawn.hpp" 4 | #include "ccsplayer_viewmodelservices.hpp" 5 | 6 | namespace os2::sdk { 7 | class EntitySpottedState_t { 8 | public: 9 | bool m_bSpotted; // 0x8 - 0x9 10 | unsigned char pad_9[0x3]; // 0x9 - 0xC 11 | std::uint32_t m_bSpottedByMask[2]; // 0xC - 0x14 12 | }; 13 | 14 | static_assert(sizeof(EntitySpottedState_t) == 0x14 - 0x8); 15 | 16 | class C_CSPlayerPawnBase : public C_BasePlayerPawn { 17 | public: 18 | SCHEMA_FIELD(m_pViewModelServices, "C_CSPlayerPawnBase", 19 | "m_pViewModelServices", CCSPlayer_ViewModelServices*); 20 | SCHEMA_FIELD(m_flFlashDuration, "C_CSPlayerPawnBase", "m_flFlashDuration", 21 | float); 22 | SCHEMA_FIELD(m_flFlashMaxAlpha, "C_CSPlayerPawnBase", "m_flFlashMaxAlpha", 23 | float); 24 | SCHEMA_FIELD(m_flFlashBangTime, "C_CSPlayerPawnBase", "m_flFlashBangTime", 25 | float); 26 | SCHEMA_FIELD(m_entitySpottedState, "C_CSPlayerPawnBase", 27 | "m_entitySpottedState", EntitySpottedState_t); 28 | SCHEMA_FIELD(m_bHasMovedSinceSpawn, "C_CSPlayerPawnBase", 29 | "m_bHasMovedSinceSpawn", bool); 30 | SCHEMA_FIELD(m_bIsScoped, "C_CSPlayerPawnBase", "m_bIsScoped", bool); 31 | }; 32 | }; // namespace os2::sdk 33 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_csweaponbase.cpp: -------------------------------------------------------------------------------- 1 | #include "c_csweaponbase.hpp" 2 | 3 | #include "../../../memory/memory.hpp" 4 | 5 | void os2::sdk::C_CSWeaponBase::AddStattrakEntity() { 6 | if (!os2::fn::AddStattrakEntity) return; 7 | return os2::fn::AddStattrakEntity(m_hStattrakAttachment()); 8 | } 9 | 10 | void os2::sdk::C_CSWeaponBase::AddNametagEntity() { 11 | if (!os2::fn::AddNametagEntity) return; 12 | return os2::fn::AddNametagEntity(m_hNametagAttachment()); 13 | } 14 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_csweaponbase.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_baseplayerweapon.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_CSWeaponBase : public C_BasePlayerWeapon { 7 | public: 8 | void AddStattrakEntity(); 9 | void AddNametagEntity(); 10 | 11 | SCHEMA_FIELD(m_bUIWeapon, "C_CSWeaponBase", "m_bUIWeapon", bool); 12 | SCHEMA_FIELD(m_iOriginalTeamNumber, "C_CSWeaponBase", "m_iOriginalTeamNumber", 13 | int); 14 | PSCHEMA_FIELD_OFFSET(m_hStattrakAttachment, "C_CSWeaponBase", 15 | "m_iNumEmptyAttacks", 4, void); 16 | PSCHEMA_FIELD_OFFSET(m_hNametagAttachment, "C_CSWeaponBase", 17 | "m_iNumEmptyAttacks", 20, void); 18 | }; 19 | }; // namespace os2::sdk 20 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_plantedc4.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_basemodelentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_PlantedC4 : public C_BaseModelEntity { 7 | public: 8 | SCHEMA_FIELD(m_bBombTicking, "C_PlantedC4", "m_bBombTicking", 9 | bool); // Offset: 3696 10 | SCHEMA_FIELD(m_nBombSite, "C_PlantedC4", "m_nBombSite", 11 | int32_t); // Offset: 3700 12 | SCHEMA_FIELD(m_flNextBeep, "C_PlantedC4", "m_flNextBeep", 13 | float); // Offset: 3740 14 | SCHEMA_FIELD(m_flC4Blow, "C_PlantedC4", "m_flC4Blow", float); // Offset: 3744 15 | SCHEMA_FIELD(m_flTimerLength, "C_PlantedC4", "m_flTimerLength", 16 | float); // Offset: 3752 17 | SCHEMA_FIELD(m_flDefuseLength, "C_PlantedC4", "m_flDefuseLength", 18 | float); // Offset: 3776 19 | SCHEMA_FIELD(m_flDefuseCountDown, "C_PlantedC4", "m_flDefuseCountDown", 20 | float); // Offset: 3780 21 | SCHEMA_FIELD(m_hBombDefuser, "C_PlantedC4", "m_hBombDefuser", 22 | CHandle); // Offset: 3788 23 | SCHEMA_FIELD(m_pBombDefuser, "C_PlantedC4", "m_pBombDefuser", 24 | CHandle); // Offset: 3808 25 | }; 26 | }; // namespace os2::sdk 27 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/c_pointcamera.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_baseentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class C_PointCamera : C_BaseEntity { 7 | public: 8 | SCHEMA_FIELD(m_FOV, "C_PointCamera", "m_FOV", 9 | float); // Offset: 1344 10 | SCHEMA_FIELD(m_Resolution, "C_PointCamera", "m_Resolution", 11 | float); // Offset: 1348 12 | SCHEMA_FIELD(m_bFogEnable, "C_PointCamera", "m_bFogEnable", 13 | bool); // Offset: 1352 14 | SCHEMA_FIELD(m_flFogStart, "C_PointCamera", "m_flFogStart", 15 | float); // Offset: 1360 16 | SCHEMA_FIELD(m_flFogEnd, "C_PointCamera", "m_flFogEnd", 17 | float); // Offset: 1364 18 | SCHEMA_FIELD(m_flFogMaxDensity, "C_PointCamera", "m_flFogMaxDensity", 19 | float); // Offset: 1368 20 | SCHEMA_FIELD(m_bActive, "C_PointCamera", "m_bActive", bool); // Offset: 1372 21 | SCHEMA_FIELD(m_bUseScreenAspectRatio, "C_PointCamera", 22 | "m_bUseScreenAspectRatio", bool); // Offset: 1373 23 | SCHEMA_FIELD(m_flAspectRatio, "C_PointCamera", "m_flAspectRatio", 24 | float); // Offset: 1376 25 | SCHEMA_FIELD(m_bNoSky, "C_PointCamera", "m_bNoSky", bool); // Offset: 1380 26 | SCHEMA_FIELD(m_fBrightness, "C_PointCamera", "m_fBrightness", 27 | float); // Offset: 1384 28 | SCHEMA_FIELD(m_flZFar, "C_PointCamera", "m_flZFar", float); // Offset: 1388 29 | SCHEMA_FIELD(m_flZNear, "C_PointCamera", "m_flZNear", float); // Offset: 1392 30 | SCHEMA_FIELD(m_bCanHLTVUse, "C_PointCamera", "m_bCanHLTVUse", 31 | bool); // Offset: 1396 32 | SCHEMA_FIELD(m_bDofEnabled, "C_PointCamera", "m_bDofEnabled", 33 | bool); // Offset: 1397 34 | SCHEMA_FIELD(m_flDofNearBlurry, "C_PointCamera", "m_flDofNearBlurry", 35 | float); // Offset: 1400 36 | SCHEMA_FIELD(m_flDofNearCrisp, "C_PointCamera", "m_flDofNearCrisp", 37 | float); // Offset: 1404 38 | SCHEMA_FIELD(m_flDofFarCrisp, "C_PointCamera", "m_flDofFarCrisp", 39 | float); // Offset: 1408 40 | SCHEMA_FIELD(m_flDofFarBlurry, "C_PointCamera", "m_flDofFarBlurry", 41 | float); // Offset: 1412 42 | SCHEMA_FIELD(m_flDofTiltToGround, "C_PointCamera", "m_flDofTiltToGround", 43 | float); // Offset: 1416 44 | SCHEMA_FIELD(m_TargetFOV, "C_PointCamera", "m_TargetFOV", 45 | float); // Offset: 1420 46 | }; 47 | }; // namespace os2::sdk // namespace os2::sdk 48 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/cbaseplayercontroller.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_basemodelentity.hpp" 4 | 5 | namespace os2::sdk { 6 | class CBasePlayerController : public C_BaseModelEntity { 7 | public: 8 | SCHEMA_FIELD(m_steamID, "CBasePlayerController", "m_steamID", uint64_t); 9 | SCHEMA_FIELD(m_hPawn, "CBasePlayerController", "m_hPawn", CHandle); 10 | SCHEMA_FIELD(m_iDesiredFOV, "CBasePlayerController", "m_iDesiredFOV", uint32_t); 11 | SCHEMA_FIELD(m_bIsLocalPlayerController, "CBasePlayerController", 12 | "m_bIsLocalPlayerController", bool); 13 | }; 14 | }; // namespace os2::sdk 15 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/ccollisionproperty.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../api.hpp" 4 | 5 | #include "../../../math/classes/vector.hpp" 6 | 7 | #include "../../../schema/schema.hpp" 8 | 9 | namespace os2::sdk { 10 | class CCollisionProperty { 11 | public: 12 | SCHEMA_FIELD(m_vecMins, "CCollisionProperty", "m_vecMins", Vector); 13 | SCHEMA_FIELD(m_vecMaxs, "CCollisionProperty", "m_vecMaxs", Vector); 14 | SCHEMA_FIELD(m_solidFlags, "CCollisionProperty", "m_usSolidFlags", 15 | std::uint16_t); 16 | 17 | auto CollisionMask() { 18 | return *reinterpret_cast((uintptr_t)(this) + 0x38); 19 | } 20 | }; 21 | }; // namespace os2::sdk 22 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/ccsplayer_viewmodelservices.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../schema/schema.hpp" 4 | 5 | #include "../chandle.hpp" 6 | 7 | namespace os2::sdk { 8 | class CCSPlayer_ViewModelServices { 9 | public: 10 | PSCHEMA_FIELD(m_hViewModel, "CCSPlayer_ViewModelServices", "m_hViewModel", 11 | CHandle); 12 | }; 13 | }; // namespace os2::sdk 14 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/ccsplayercontroller.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_csplayerpawn.hpp" 4 | #include "cbaseplayercontroller.hpp" 5 | 6 | namespace os2::sdk { 7 | class CCSPlayerController : public CBasePlayerController { 8 | public: 9 | SCHEMA_FIELD(m_sSanitizedPlayerName, "CCSPlayerController", 10 | "m_sSanitizedPlayerName", const char*); 11 | SCHEMA_FIELD(m_iPawnHealth, "CCSPlayerController", "m_iPawnHealth", uint32_t); 12 | SCHEMA_FIELD(m_iPawnArmor, "CCSPlayerController", "m_iPawnArmor", uint32_t); 13 | SCHEMA_FIELD(m_bPawnHasDefuser, "CCSPlayerController", "m_bPawnHasDefuser", 14 | bool); 15 | SCHEMA_FIELD(m_bPawnHasHelmet, "CCSPlayerController", "m_bPawnHasHelmet", 16 | bool); 17 | SCHEMA_FIELD(m_bPawnIsAlive, "CCSPlayerController", "m_bPawnIsAlive", bool); 18 | }; 19 | }; // namespace os2::sdk 20 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/centityidentity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../schema/schema.hpp" 4 | 5 | #include "../../../math/math.hpp" 6 | 7 | #include "../chandle.hpp" 8 | 9 | namespace os2::sdk { 10 | class CEntityIdentity { 11 | public: 12 | SCHEMA_FIELD(m_designerName, "CEntityIdentity", "m_designerName", 13 | const char*); 14 | SCHEMA_FIELD(m_flags, "CEntityIdentity", "m_flags", uint32_t); 15 | }; 16 | }; // namespace os2::sdk 17 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/centityinstance.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../interfaces/cschemasystem.hpp" 4 | 5 | #include "centityidentity.hpp" 6 | 7 | namespace os2::sdk { 8 | class CEntityInstance { 9 | public: 10 | auto Schema_DynamicBinding() { 11 | SchemaClassInfoData_t* rv = nullptr; 12 | CALL_VIRTUAL(void, 34, this, &rv); 13 | return rv; 14 | } 15 | 16 | auto GetRefEHandle() { 17 | CEntityIdentity* pIdentity = m_pEntity(); 18 | auto v3 = *(uint32_t*)(pIdentity + 16); 19 | auto v4 = ENT_ENTRY_MASK; 20 | auto v5 = ((v3 >> 15) - (*(uint32_t*)(pIdentity + 48) & 1)) << 15; 21 | if (v3 != -1) { 22 | v4 = *(uint32_t*)(pIdentity + 16) & ENT_ENTRY_MASK; 23 | } 24 | 25 | return CHandle(v4 | v5); 26 | } 27 | 28 | SCHEMA_FIELD(m_pEntity, "CEntityInstance", "m_pEntity", 29 | CEntityIdentity*); 30 | }; 31 | }; // namespace os2::sdk 32 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/cgamescenenode.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../memory/memory.hpp" 2 | 3 | #include "cgamescenenode.hpp" 4 | 5 | using namespace os2::sdk; 6 | 7 | void CGameSceneNode::SetMeshGroupMask(uint64_t meshGroupMask) { 8 | if (!os2::fn::SetMeshGroupMask) return; 9 | return os2::fn::SetMeshGroupMask(this, meshGroupMask); 10 | } 11 | 12 | bool CGameSceneNode::GetBonePositionAndRotation(const std::int32_t bone_index, 13 | glm::vec3& bone_position, 14 | glm::vec4& bone_rotation) { 15 | CSkeletonInstance* skeleton = GetSkeletonInstance(); 16 | 17 | if (skeleton == nullptr) return false; 18 | 19 | const CModelState model_state = skeleton->m_modelState(); 20 | 21 | const CBoneData* bone_array = model_state.bones; 22 | 23 | if (bone_array == nullptr) return false; 24 | 25 | const CBoneData& data = bone_array[bone_index]; 26 | 27 | bone_position = data.position; 28 | bone_rotation = data.rotation; 29 | 30 | return true; 31 | } 32 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/cgamescenenode.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../math/classes/transform.hpp" 4 | 5 | namespace os2::sdk { 6 | class CSkeletonInstance; 7 | 8 | class CGameSceneNode { 9 | public: 10 | bool GetBonePositionAndRotation(std::int32_t bone_index, 11 | glm::vec3& bone_position, 12 | glm::vec4& bone_rotation); 13 | void SetMeshGroupMask(uint64_t meshGroupMask); 14 | 15 | __forceinline CSkeletonInstance* GetSkeletonInstance() { 16 | return CALL_VIRTUAL(CSkeletonInstance*, 8, this); 17 | } 18 | 19 | SCHEMA_FIELD(m_nodeToWorld, "CGameSceneNode", "m_nodeToWorld", CTransform); 20 | SCHEMA_FIELD(m_angAbsRotation, "CGameSceneNode", "m_angAbsRotation", 21 | glm::vec3); 22 | SCHEMA_FIELD(m_angRotation, "CGameSceneNode", "m_angRotation", glm::vec3); 23 | SCHEMA_FIELD(m_bDormant, "CGameSceneNode", "m_bDormant", bool); 24 | SCHEMA_FIELD(m_vecAbsOrigin, "CGameSceneNode", "m_vecAbsOrigin", glm::vec3); 25 | SCHEMA_FIELD(m_vecOrigin, "CGameSceneNode", "m_vecOrigin", glm::vec3); 26 | }; 27 | }; // namespace os2::sdk 28 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/cplayer_cameraservices.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../schema/schema.hpp" 4 | 5 | namespace os2::sdk { 6 | class CPlayer_CameraServices { 7 | public: 8 | }; 9 | }; // namespace os2::sdk 10 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/cplayer_weaponservices.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../schema/schema.hpp" 4 | #include "../chandle.hpp" 5 | #include "../cnetworkutlvectorbase.hpp" 6 | #include "c_csweaponbase.hpp" 7 | 8 | namespace os2::sdk { 9 | class CPlayer_WeaponServices { 10 | public: 11 | SCHEMA_FIELD(m_hActiveWeapon, "CPlayer_WeaponServices", "m_hActiveWeapon", 12 | CHandle); 13 | }; 14 | }; // namespace os2::sdk 15 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/entity/hitbox/hitbox.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../cutlvector.hpp" 4 | 5 | namespace os2::sdk { 6 | inline const std::string animationsystem_dll = ANIMATIONSYSTEM_DLL; 7 | 8 | class CHitBox { 9 | public: 10 | SCHEMA_EXTENDED(m_vMinBounds, animationsystem_dll, "CHitBox", "m_vMinBounds", 11 | Vector, 0); 12 | SCHEMA_EXTENDED(m_vMaxBounds, animationsystem_dll, "CHitBox", "m_vMaxBounds", 13 | Vector, 0); 14 | 15 | private: 16 | char pad[0x70]; // sizeof CHitBox 17 | }; 18 | 19 | class CHitBoxSet { 20 | public: 21 | SCHEMA_EXTENDED(m_HitBoxes, animationsystem_dll, "CHitBoxSet", "m_HitBoxes", 22 | CUtlVector, 0); 23 | }; 24 | }; // namespace os2::sdk 25 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/gcsdk/cgcclient.cpp: -------------------------------------------------------------------------------- 1 | #include "cgcclient.hpp" 2 | 3 | #include "../../../memory/memory.hpp" 4 | 5 | os2::sdk::CGCClientSharedObjectCache* os2::sdk::CGCClient::FindSOCache( 6 | SOID_t ID, bool bCreateIfMissing) { 7 | if (!os2::fn::FindSOCache) return nullptr; 8 | return os2::fn::FindSOCache(this, ID, bCreateIfMissing); 9 | } 10 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/gcsdk/cgcclient.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace os2::sdk { 6 | class CGCClientSharedObjectCache; 7 | 8 | struct SOID_t { 9 | uint64_t m_id; 10 | uint32_t m_type; 11 | uint32_t m_padding; 12 | }; 13 | 14 | class CGCClient { 15 | public: 16 | CGCClientSharedObjectCache* FindSOCache(SOID_t ID, 17 | bool bCreateIfMissing = true); 18 | }; 19 | }; // namespace os2::sdk 20 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/gcsdk/cgcclientsystem.cpp: -------------------------------------------------------------------------------- 1 | #include "cgcclientsystem.hpp" 2 | 3 | #include "../../../memory/memory.hpp" 4 | 5 | os2::sdk::CGCClientSystem* os2::sdk::CGCClientSystem::GetInstance() { 6 | if (!os2::fn::GetClientSystem) return nullptr; 7 | return os2::fn::GetClientSystem(); 8 | } 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/gcsdk/cgcclientsystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cgcclient.hpp" 4 | 5 | namespace os2::sdk { 6 | class CGCClientSystem { 7 | public: 8 | static CGCClientSystem* GetInstance(); 9 | 10 | CGCClient* GetCGCClient() { 11 | return reinterpret_cast((uintptr_t)(this) + 0xB8); 12 | } 13 | }; 14 | }; // namespace os2::sdk 15 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/material_system/material_system.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class CBaseSceneObjectDesc {}; 5 | class CMaterialDrawDescriptor {}; 6 | }; // namespace os2::sdk 7 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/types/c_sounddata.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class C_SoundData_Origin { 6 | public: 7 | glm::vec3 origin; 8 | }; 9 | 10 | class C_SoundData { 11 | public: 12 | char pad_0000[8]; 13 | char* sound_name; 14 | char pad_0010[16]; 15 | class C_SoundData_Origin* get_origin; 16 | }; 17 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/types/c_trace.cpp: -------------------------------------------------------------------------------- 1 | #include "c_trace.hpp" 2 | 3 | #include 4 | 5 | #include "../../../memory/memory.hpp" 6 | 7 | os2::sdk::C_TraceFilter::C_TraceFilter(std::uint32_t Mask, 8 | C_CSPlayerPawn* Skip1, 9 | C_CSPlayerPawn* Skip2, int Layer) { 10 | TraceMask = Mask; 11 | V1[0] = V1[1] = 0; 12 | V2 = 7; 13 | V3 = Layer; 14 | V4 = 0x49; 15 | V5 = 0; 16 | 17 | SkipHandles[0] = os2::fn::GetEntityHandle(Skip1); 18 | SkipHandles[1] = Skip1->GetOwnerHandle(); 19 | SkipHandles[2] = 0; 20 | SkipHandles[3] = 0; 21 | 22 | Collisions[0] = Skip1->GetCollisionMask(); 23 | Collisions[1] = 0; 24 | } 25 | 26 | os2::sdk::C_SurfaceData* os2::sdk::C_GameTrace::GetSurfaceData() { 27 | if (!os2::fn::GetSurfaceData) return nullptr; 28 | return reinterpret_cast(os2::fn::GetSurfaceData(Surface)); 29 | } 30 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/types/c_trace.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../source-sdk.hpp" 4 | 5 | #include "../../../math/classes/vector.hpp" 6 | 7 | #include "../entity/c_csplayerpawn.hpp" 8 | 9 | #define COMBINE(x, y) x##y 10 | #define COMBINE2(x, y) COMBINE(x, y) 11 | 12 | #define PAD_CLASS_DEBUG(sz) int COMBINE2(pad_, __COUNTER__)[sz]; 13 | 14 | namespace os2::sdk { 15 | struct C_Ray { 16 | Vector Start; 17 | Vector End; 18 | Vector Mins; 19 | Vector Maxs; 20 | PAD_CLASS(0x4); 21 | std::uint8_t UnkType; 22 | }; 23 | 24 | struct C_SurfaceData { 25 | PAD_CLASS(0x8); 26 | float PenetrationModifier; 27 | float DamageModifier; 28 | PAD_CLASS(0x4); 29 | int Material; 30 | }; 31 | 32 | struct C_TraceHitboxData { 33 | PAD_CLASS_DEBUG(0x38 / 0x4); 34 | int Hitgroup; 35 | PAD_CLASS_DEBUG(0x2); 36 | PAD_CLASS(0x1); 37 | int HitboxId; 38 | PAD_CLASS_DEBUG(0x24 / 0x4); 39 | }; 40 | 41 | class C_GameTrace { 42 | public: 43 | C_SurfaceData* GetSurfaceData(); 44 | 45 | int GetHitboxId() { 46 | if (HitboxData) return HitboxData->HitboxId; 47 | return 0; 48 | } 49 | 50 | int GetHitgroup() { 51 | if (HitboxData) return HitboxData->Hitgroup; 52 | return 0; 53 | } 54 | 55 | void* Surface; 56 | C_CSPlayerPawn* HitEntity; 57 | C_TraceHitboxData* HitboxData; 58 | PAD_CLASS(0x10); 59 | std::uint32_t Contents; 60 | PAD_CLASS(0x58); 61 | Vector EndPos; 62 | PAD_CLASS(0x1C); 63 | float Fraction; 64 | PAD_CLASS(0x10); 65 | }; 66 | 67 | class C_TraceFilter { 68 | public: 69 | std::uint64_t TraceMask; 70 | std::uint64_t V1[2]; 71 | std::uint32_t SkipHandles[4]; 72 | std::uint16_t Collisions[2]; 73 | std::uint16_t V2; 74 | std::uint8_t V3; 75 | std::uint8_t V4; 76 | std::uint8_t V5; 77 | 78 | virtual ~C_TraceFilter() {} 79 | virtual bool function() { return true; } 80 | 81 | C_TraceFilter(std::uint32_t Mask, C_CSPlayerPawn* Skip1, 82 | C_CSPlayerPawn* Skip2, int Layer); 83 | }; 84 | }; // namespace os2::sdk 85 | 86 | static_assert(sizeof(os2::sdk::C_TraceHitboxData) == 0x70); 87 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/classes/types/cglobalvarsbase.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class CGlobalVarsBase { 5 | public: 6 | float real_time; 7 | int frame_count; 8 | float unknown1; 9 | float unknown2; 10 | int max_clients; 11 | float interval_per_tick; 12 | int unknown3; 13 | int unknown4; 14 | void* m_unkfunc; 15 | float unknown5; 16 | float current_time; 17 | float current_time2; 18 | PAD_CLASS(0xC) 19 | int tick_count; 20 | float interval_per_tick2; 21 | void* current_netchan; 22 | PAD_CLASS(0x130) 23 | char* current_map; 24 | char* current_map_name; 25 | }; 26 | }; // namespace os2::sdk 27 | 28 | static_assert(sizeof(os2::sdk::CGlobalVarsBase) == 0x0190); 29 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/ccvar.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | namespace strings { 7 | inline const std::string log_ccvar_var_found = 8 | os2_string("os2::sdk::CCvar::FindVarByName() found '%s' at -> %p\n"); 9 | inline const std::string log_ccvar_var_not_found = 10 | os2_string("os2::sdk::CCvar::FindVarByName() couldn't find '%s'.\n"); 11 | }; // namespace strings 12 | 13 | class ConVar { 14 | public: 15 | const char* m_name; 16 | 17 | template 18 | T GetValue() { 19 | // Tip: Do not modify the value by making this a reference. 20 | // It'll get your account flagged. 21 | return *reinterpret_cast((uintptr_t)(this) + 0x40); 22 | } 23 | }; 24 | 25 | class CCvar { 26 | public: 27 | auto GetFirstCvarIterator(uint64_t& idx) { 28 | return CALL_VIRTUAL(void*, 12, this, &idx); 29 | } 30 | 31 | auto GetNextCvarIterator(uint64_t& idx) { 32 | return CALL_VIRTUAL(void*, 13, this, &idx, idx); 33 | } 34 | 35 | auto FindVarByIndex(uint64_t index) { 36 | return CALL_VIRTUAL(ConVar*, 37, this, index); 37 | } 38 | 39 | auto FindVarByName(const char* var_name) -> ConVar* { 40 | // Tip: There's logging in this function because this should run ONLY 41 | // once for every ConVar. If the console is spammed it means you haven't 42 | // made the variable static. 43 | 44 | uint64_t i = 0; 45 | GetFirstCvarIterator(i); 46 | while (i != 0xFFFFFFFF) { 47 | ConVar* pCvar = FindVarByIndex(i); 48 | if (strcmp(pCvar->m_name, var_name) == 0) { 49 | LOG(strings::log_ccvar_var_found.c_str(), var_name, pCvar); 50 | return pCvar; 51 | } 52 | GetNextCvarIterator(i); 53 | } 54 | 55 | LOG(strings::log_ccvar_var_not_found.c_str(), var_name); 56 | return nullptr; 57 | } 58 | }; 59 | }; // namespace os2::sdk 60 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/cengineclient.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../virtual/virtual.hpp" 6 | 7 | namespace os2::sdk { 8 | class CEngineClient { 9 | public: 10 | __forceinline std::int32_t GetMaxClients() { 11 | return CALL_VIRTUAL(std::int32_t, 31, this); 12 | } 13 | __forceinline bool IsInGame() { return CALL_VIRTUAL(bool, 32, this); } 14 | __forceinline bool IsConnected() { return CALL_VIRTUAL(bool, 33, this); } 15 | 16 | __forceinline glm::vec2 GetScreenSize() { 17 | std::int32_t w, h; 18 | 19 | CALL_VIRTUAL(void, 50, this, &w, &h); 20 | 21 | return {static_cast(w), static_cast(h)}; 22 | } 23 | }; 24 | }; // namespace os2::sdk 25 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/cgameeventmanager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class IGameEvent { 5 | public: 6 | const char* get_name() { return CALL_VIRTUAL(const char*, 1, this); } 7 | 8 | bool is_empty(const char* key_name) { 9 | return CALL_VIRTUAL(bool, 5, this, key_name); 10 | } 11 | 12 | bool get_bool(const char* key_name, const bool default_value = false) { 13 | return CALL_VIRTUAL(bool, 6, this, key_name, default_value); 14 | } 15 | 16 | std::int32_t get_int(const char* key_name, 17 | const std::int32_t default_value = 0) { 18 | return CALL_VIRTUAL(std::int32_t, 7, this, key_name, default_value); 19 | } 20 | 21 | std::uint64_t get_uint64(const char* key_name, 22 | const std::uint64_t default_value = 0) { 23 | return CALL_VIRTUAL(std::uint64_t, 8, this, key_name, default_value); 24 | } 25 | 26 | float get_float(const char* key_name, const float default_value = 0.f) { 27 | return CALL_VIRTUAL(float, 9, this, key_name, default_value); 28 | } 29 | 30 | const char* get_string(const char* key_name, const char* default_value = "") { 31 | return CALL_VIRTUAL(const char*, 10, this, key_name, default_value); 32 | } 33 | 34 | const wchar_t* get_wstring(const char* key_name, 35 | const wchar_t* default_value = L"") { 36 | return CALL_VIRTUAL(const wchar_t*, 11, this, key_name, default_value); 37 | } 38 | }; 39 | 40 | class IGameEventListener2 { 41 | public: 42 | virtual ~IGameEventListener2() = default; 43 | virtual void fire_game_event(IGameEvent* event) = 0; 44 | virtual int get_event_debug_id() = 0; 45 | }; 46 | }; // namespace os2::sdk 47 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/cgameresourceserviceclient.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | class CGameEntitySystem; 7 | 8 | class CGameResourceService { 9 | public: 10 | CGameEntitySystem* GetGameEntitySystem() { 11 | return *reinterpret_cast((uintptr_t)(this) + 0x58); 12 | } 13 | }; 14 | }; // namespace os2::sdk 15 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/cinputsystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class CInputSystem { 5 | public: 6 | bool& IsRelativeMouseMode() { 7 | // Offset in 'CInputSystem::SetRelativeMouseMode'. 8 | // 'CInputSystem::SetRelativeMouseMode' index is 76. 9 | return *reinterpret_cast((uintptr_t)(this) + 0x4F); 10 | } 11 | 12 | void* GetSDLWindow() { 13 | // Offset in 'CInputSystem::DebugSpew'. 14 | // xref: "current coordinate bias %s: %g,%g scale %g,%g\n". 15 | return *reinterpret_cast((uintptr_t)(this) + 0x2678); 16 | } 17 | }; 18 | }; // namespace os2::sdk 19 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/clocalize.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | class CLocalize { 7 | public: 8 | auto FindSafe(const char* tokenName) { 9 | return CALL_VIRTUAL(const char*, 17, this, tokenName); 10 | } 11 | }; 12 | }; // namespace os2::sdk 13 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/cmaterialsystem2.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class CMaterialSystem2 { 5 | public: 6 | __forceinline CMaterial2*** find_or_create_material_from_resource( 7 | CMaterial2*** material, const char* material_name) { 8 | return CALL_VIRTUAL(CMaterial2***, 14, this, material, material_name); 9 | } 10 | }; 11 | }; // namespace os2::sdk 12 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/cschemasystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | namespace os2::sdk { 6 | struct SchemaClassFieldData_t { 7 | const char* m_name; 8 | char pad0[0x8]; 9 | short m_offset; 10 | char pad1[0xE]; 11 | }; 12 | 13 | class SchemaClassInfoData_t { 14 | public: 15 | auto GetName() { 16 | return *reinterpret_cast((uintptr_t)(this) + 0x8); 17 | } 18 | 19 | auto GetFieldsSize() { 20 | return *reinterpret_cast((uintptr_t)(this) + 0x1C); 21 | } 22 | 23 | auto GetFields() { 24 | return *reinterpret_cast((uintptr_t)(this) + 25 | 0x28); 26 | } 27 | }; 28 | 29 | class CSchemaSystemTypeScope { 30 | public: 31 | auto FindDeclaredClass(const char* pClass) { 32 | SchemaClassInfoData_t* rv = nullptr; 33 | CALL_VIRTUAL(void, 2, this, &rv, pClass); 34 | return rv; 35 | } 36 | }; 37 | 38 | class CSchemaSystem { 39 | public: 40 | auto FindTypeScopeForModule(const char* module, void* a2 = nullptr) { 41 | return CALL_VIRTUAL(CSchemaSystemTypeScope*, 13, this, module, a2); 42 | } 43 | }; 44 | }; // namespace os2::sdk 45 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/csource2client.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../virtual/virtual.hpp" 4 | 5 | #include "../classes/econ/ceconitemsystem.hpp" 6 | 7 | namespace os2::sdk { 8 | class CSource2Client { 9 | public: 10 | auto GetEconItemSystem() { return CALL_VIRTUAL(CEconItemSystem*, 111, this); } 11 | }; 12 | }; // namespace os2::sdk 13 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/interfaces/iscenelayer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace os2::sdk { 4 | class ISceneLayer { 5 | public: 6 | // @todo 7 | }; 8 | }; // namespace os2::sdk 9 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/source-sdk/source-sdk.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define COMBINE(x, y) x##y 4 | #define COMBINE2(x, y) COMBINE(x, y) 5 | 6 | #define PAD_CLASS(sz) \ 7 | private: \ 8 | std::uint8_t COMBINE2(pad_, __COUNTER__)[sz]; \ 9 | \ 10 | public: 11 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/utilities/static_string.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace os2::string { 6 | constexpr uint32_t modulus() { return 0x7fffffff; } 7 | 8 | // Create entropy using __FILE__ and __LINE__ 9 | template 10 | constexpr uint32_t seed(const char (&entropy)[N], const uint32_t iv = 0) { 11 | auto value{iv}; 12 | for (size_t i{0}; i < N; i++) { 13 | // Xor 1st byte of seed with input byte 14 | value = (value & ((~0) << 8)) | ((value & 0xFF) ^ entropy[i]); 15 | // Rotl 1 byte 16 | value = value << 8 | value >> ((sizeof(value) * 8) - 8); 17 | } 18 | // The seed is required to be less than the modulus and odd 19 | while (value > modulus()) value = value >> 1; 20 | return value << 1 | 1; 21 | } 22 | 23 | constexpr uint32_t prng(const uint32_t input) { 24 | return (input * 48271) % modulus(); 25 | } 26 | }; 27 | 28 | template 29 | struct encrypted { 30 | int seed; 31 | T data[N]; 32 | }; 33 | 34 | template 35 | constexpr auto crypt(const char (&input)[N], const uint32_t seed = 0) { 36 | encrypted blob{}; 37 | blob.seed = seed; 38 | for (uint32_t index{0}, stream{seed}; index < N; index++) { 39 | blob.data[index] = input[index] ^ stream; 40 | stream = os2::string::prng(stream); 41 | } 42 | return blob; 43 | } 44 | 45 | #define os2_string(STRING) \ 46 | ([&] { \ 47 | constexpr auto _{crypt(STRING, os2::string::seed(__FILE__, __LINE__))}; \ 48 | return std::string{crypt(_.data, _.seed).data}; \ 49 | }()) 50 | -------------------------------------------------------------------------------- /OpenSource2-SDK/src/sdk/virtual/virtual.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "../framework.hpp" 7 | 8 | #include "../utilities/static_string.hpp" 9 | 10 | #define CALL_VIRTUAL(retType, idx, ...) \ 11 | os2::sdk::vmt::CallVirtual(idx, __VA_ARGS__) 12 | 13 | namespace os2::sdk::vmt { 14 | namespace strings { 15 | inline const std::string log_vmt_null_class = 16 | os2_string("Tried getting virtual function from a null class.\n"); 17 | inline const std::string log_vmt_null_vtable = 18 | os2_string("Tried getting virtual function from a null vtable.\n"); 19 | inline const std::string log_vmt_null_vfunc = 20 | os2_string("Tried calling a null virtual function.\n"); 21 | }; // namespace strings 22 | 23 | template 24 | inline T GetVMethod(uint32_t uIndex, void* pClass) { 25 | if (!pClass) { 26 | LOG(strings::log_vmt_null_class.c_str()); 27 | return T{}; 28 | } 29 | 30 | void** pVTable = *static_cast(pClass); 31 | if (!pVTable) { 32 | LOG(strings::log_vmt_null_vtable.c_str()); 33 | return T{}; 34 | } 35 | 36 | return reinterpret_cast(pVTable[uIndex]); 37 | } 38 | 39 | template 40 | inline T CallVirtual(uint32_t uIndex, void* pClass, Args... args) { 41 | auto pFunc = GetVMethod(uIndex, pClass); 42 | if (!pFunc) { 43 | LOG(strings::log_vmt_null_vfunc.c_str()); 44 | return T{}; 45 | } 46 | 47 | return pFunc(pClass, args...); 48 | } 49 | }; // namespace os2::sdk::vmt 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # opensource2 2 | (Open)Source² — a reasonable CS2 Open Source SDK for your projects. 3 | 4 | #### Cheat is gonna be updated, milestones planned so far: 5 | * Reaching Osiris/Aimtux functionality in CS2; 6 | * Introducing measurements & collecting data for data science; 7 | * Creation of indistinguishable, highly effective aim-assist; 8 | * Writing an Electron (Node.js) DLL Injector/loader with VAC bypass and automatic updates; 9 | 10 | ### How to use? 11 | 1. Clone repo: ``git clone --recurse-submodules --remote-submodules https://github.com/alza54/opensource2`` 12 | 2. Make sure to have DirectX 11 SDK installed. 13 | 3. Open the solution in Visual Studio 2022 on Windows (ideally). 14 | ##### Note: no need to copy & paste any dependencies into the solution, as they are automatically cloned with git. 15 | 4. As Counter Strike 2 is a 64-bit application, compile .DLL as x64 Debug or Release. 16 | 5. Inject the .DLL into the game with an injector of your choice. Ideally write your own, as it's not a hard thing to do. 17 | 18 | ### Is it working now? 19 | The software has been tested on [build ID 12321656 released on 9/29/2023](https://steamdb.info/patchnotes/12321656/ "SteamDB.info CS2 Patch Notes") 20 | 21 | ### Contributions 22 | * The software is in very early development stage, any contributions are welcomed. 23 | 24 | ### Is it undetected? 25 | * Don't treat it as a cheat to compile. 26 | * You should always modify the SDK, never use cheats built-in, as they are examples, from which you can take a inspiration. 27 | 28 | ### Changelog 29 | 30 | #### v0.5.0 31 | 32 | * **Features / Visuals**: Added Chams. 33 | * **Features / ESP**: Optimized text rendering. 34 | * **Features / ESP**: Added 3D-box ESP for objects. 35 | * **SDK**: added collision-based bounding-box calculation. 36 | * **SDK**: added hitbox-based bounding-box calculation. 37 | 38 | #### v0.4.0 ("Everyday" Release) 39 | 40 | * **SDK**: Corrected indexes of ***CEngineClient*** after the game update. 41 | * **SDK**: Corrected ***C_TraceHitboxData*** struct. 42 | * **SDK**: introduced ***C_PointCamera*** schema. 43 | * **SDK / Bone System**: Introduced ***GetBoneName*** method. 44 | * **SDK / CCSPlayer_CameraServices**: Corrected to the new implementation (no ``m_iFOV`` property anymore, ***CPlayer_CameraServices*** class instance pointer reachable now). 45 | * **SDK / CBasePlayerController**: extended implementation. 46 | * **SDK / m_szLastPlaceName**: this property got moved from ***C_CSPlayerPawnBase*** to ***C_CSPlayerPawn*** with the game update. 47 | * **SDK / C_BaseEntity**: added a boolean ``IsPointCamera()`` check to ***C_BaseEntity*** class. 48 | * **SDK**: Cleaned the code. 49 | * **Features**: Organized features with macros and dependency injection. 50 | * **Features / Drawing**: Introduced a (Function class instance) wrapper for the methods related to drawing on the screen. 51 | * **Features / Drawing**: Introduced a mutex lock for thread-safe rendering. 52 | * **Features / Drawing**: Introduced ***RenderArrowToAngle*** function. 53 | * **Math**: Introduced functions: ***ToAngle***, ***CalculateRelativeAngle***, ***CalculateFOV***, ***CalculateAngleRadians***, ***deg2rad***, ***FromAngle***. 54 | * **Features: TriggerBot**: For now removed the smoke check due to update. Introduced a function pattern signature for further investigation. 55 | * **Features: AimBot**: Introduced a collection of methods related with AimBot. For now renders ***Enemies List***. 56 | * **Features: FOV Changer**: FOV Changer with an option to choose different FOV for in-game view and scenes view (eg. match start animation). 57 | 58 | ##### v0.3.0 (First Stable Release) 59 | * SDK: Introduced TraceSmoke function (returns smoke density between two lines). 60 | * SDK: fixed unload crash. 61 | * SDK: fixed unload pop-up "No" button exception. 62 | * Added new font: Red Hat Display Regular. 63 | * Fixed fonts allocation. 64 | * Trigger Bot: introduced "Max Flash Intensity" filter 65 | * Trigger Bot: introduced "Max Smoke Density" filter 66 | * Trigger Bot: introduced "Scoped Only" filter for sniper weapons. 67 | * Trigger Bot: corrected Trace Line end vector by the aim punch (recoil). 68 | 69 | # Screenshots 70 | 71 | ### v0.5.0 72 | ![Cheat SDK GUI](https://github.com/alza54/opensource2/blob/main/media/gui-v0.5.0-1.png?raw=true) 73 | ![Cheat SDK GUI](https://github.com/alza54/opensource2/blob/main/media/gui-v0.5.0-2.png?raw=true) 74 | 75 | ### v0.4.0 76 | ![Cheat SDK GUI](https://github.com/alza54/opensource2/blob/main/media/gui-v0.4.0.png?raw=true) 77 | 78 | ### v0.3.0 79 | ![Cheat SDK GUI](https://github.com/alza54/opensource2/blob/main/media/gui-v0.3.0.png?raw=true) 80 | 81 | ### v0.2.0 82 | ![Cheat SDK GUI](https://github.com/alza54/opensource2/blob/main/media/gui-v0.2.0.png?raw=true) -------------------------------------------------------------------------------- /media/gui-v0.2.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alza54/opensource2/ff7c27a072f059597277b2eeacaf012683d4ff74/media/gui-v0.2.0.png -------------------------------------------------------------------------------- /media/gui-v0.3.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alza54/opensource2/ff7c27a072f059597277b2eeacaf012683d4ff74/media/gui-v0.3.0.png -------------------------------------------------------------------------------- /media/gui-v0.4.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alza54/opensource2/ff7c27a072f059597277b2eeacaf012683d4ff74/media/gui-v0.4.0.png -------------------------------------------------------------------------------- /media/gui-v0.5.0-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alza54/opensource2/ff7c27a072f059597277b2eeacaf012683d4ff74/media/gui-v0.5.0-1.png -------------------------------------------------------------------------------- /media/gui-v0.5.0-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alza54/opensource2/ff7c27a072f059597277b2eeacaf012683d4ff74/media/gui-v0.5.0-2.png --------------------------------------------------------------------------------