├── README.md ├── cs2 external.sln ├── cs2-external-evo.vcxproj ├── cs2-external-evo.vcxproj.filters ├── cs2-external-evo.vcxproj.user └── fhook ├── core ├── core.cpp └── ctx │ ├── ctx.cpp │ └── ctx.hpp ├── framework ├── config │ ├── cfg.cpp │ └── cfg.hpp ├── framework.cpp └── framework.hpp ├── hacks ├── ctx │ ├── hacks_ctx.cpp │ └── hacks_ctx.hpp └── features │ ├── esp │ ├── esp.cpp │ └── esp.hpp │ ├── flash_builder │ ├── flash_builder.cpp │ └── flash_builder.hpp │ ├── grenade │ ├── grenades.cpp │ └── grenades.hpp │ ├── legitbot │ ├── legitbot.cpp │ └── legitbot.hpp │ ├── ragebot │ ├── ragebot.cpp │ └── ragebot.hpp │ ├── shots │ ├── shots.cpp │ ├── shots.hpp │ └── shots_hitsound.hpp │ ├── sound_system │ ├── sound.cpp │ └── sound.hpp │ └── triggerbot │ ├── triggerbot.cpp │ └── triggerbot.hpp ├── inc.hpp ├── sdk ├── animation_system │ ├── animation_system.cpp │ └── animation_system.hpp ├── classes │ ├── bone_system.hpp │ ├── entity.hpp │ └── view.hpp ├── input_system │ ├── input_system.cpp │ └── input_system.hpp ├── math │ ├── color_t.hpp │ ├── rect_t.hpp │ └── str_t.hpp ├── memory │ └── mem.hpp ├── offsets │ └── offsets.hpp ├── process_manager │ ├── process_manager.cpp │ └── process_manager.hpp ├── render │ ├── render.cpp │ ├── render.hpp │ ├── render_fonts.hpp │ └── render_sdk.hpp └── reverse │ ├── reversed_funcs.cpp │ └── reversed_funcs.hpp └── thirdparty ├── bytes.hpp ├── custom.cpp ├── custom.hpp ├── freetype └── include&lib.zip ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_freetype.cpp ├── imgui_freetype.h ├── imgui_impl_dx11.cpp ├── imgui_impl_dx11.h ├── imgui_impl_dx9.cpp ├── imgui_impl_dx9.h ├── imgui_impl_win32.cpp ├── imgui_impl_win32.h ├── imgui_internal.h ├── imgui_tables.cpp ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h └── imstb_truetype.h /README.md: -------------------------------------------------------------------------------- 1 | # CS2-External-Usermode 2 | pretty solid features - external cs2 3 | 4 | 5 | unknowncheats: 6 | https://www.unknowncheats.me/forum/counter-strike-2-a/619124-cs2-external-cheat-base.html 7 | 8 | you can find the compiled cheat on UC 9 | 10 | Screenshots 11 | https://prnt.sc/NmnlgHTiAXwY 12 | https://prnt.sc/W88Jbq4lZ8Fj 13 | https://prnt.sc/9aNByvQHNH0D 14 | -------------------------------------------------------------------------------- /cs2 external.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.7.34031.279 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cs2-external-evo", "cs2-external-evo.vcxproj", "{BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Debug|x64.ActiveCfg = Debug|x64 17 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Debug|x64.Build.0 = Debug|x64 18 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Debug|x86.ActiveCfg = Debug|Win32 19 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Debug|x86.Build.0 = Debug|Win32 20 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Release|x64.ActiveCfg = Release|x64 21 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Release|x64.Build.0 = Release|x64 22 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Release|x86.ActiveCfg = Release|Win32 23 | {BFAFCAC4-25DC-492F-B22D-5D17FD3C41B8}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {987F1B74-6BDE-406D-AD42-8AAD2AFDD8DE} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /cs2-external-evo.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {bfafcac4-25dc-492f-b22d-5d17fd3c41b8} 25 | cs2externalevo 26 | 10.0 27 | unknowncheats 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | v143 40 | true 41 | Unicode 42 | 43 | 44 | Application 45 | true 46 | v143 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | C:\Users\dutu\Desktop\cs2-external-fhook\fhook\thirdparty\freetype\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) 76 | C:\Users\dutu\Desktop\cs2-external-fhook\fhook\thirdparty\freetype\objs;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) 77 | 78 | 79 | C:\Users\segdg\Desktop\Neuer Ordner %282%29\fhook\thirdparty\freetype\include;C:\Users\Frezzy\Desktop\frezzyhook2 cs\fhook\thirdparty\freetype\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) 80 | C:\Users\segdg\Desktop\Neuer Ordner %282%29\fhook\thirdparty\freetype\objs;C:\Users\Frezzy\Desktop\frezzyhook2 cs\fhook\thirdparty\freetype\objs;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) 81 | 82 | 83 | 84 | Level3 85 | true 86 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 87 | true 88 | 89 | 90 | Console 91 | true 92 | 93 | 94 | 95 | 96 | Level3 97 | true 98 | true 99 | true 100 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 101 | true 102 | 103 | 104 | Console 105 | true 106 | true 107 | true 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 115 | true 116 | stdcpplatest 117 | 118 | 119 | Console 120 | true 121 | 122 | 123 | 124 | 125 | Level3 126 | true 127 | true 128 | true 129 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 130 | true 131 | stdcpplatest 132 | 133 | 134 | Console 135 | true 136 | true 137 | true 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /cs2-external-evo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Header Files 68 | 69 | 70 | Header Files 71 | 72 | 73 | Header Files 74 | 75 | 76 | Header Files 77 | 78 | 79 | Header Files 80 | 81 | 82 | Header Files 83 | 84 | 85 | Header Files 86 | 87 | 88 | Header Files 89 | 90 | 91 | Header Files 92 | 93 | 94 | Header Files 95 | 96 | 97 | Header Files 98 | 99 | 100 | Header Files 101 | 102 | 103 | Header Files 104 | 105 | 106 | Header Files 107 | 108 | 109 | Header Files 110 | 111 | 112 | Header Files 113 | 114 | 115 | Header Files 116 | 117 | 118 | Header Files 119 | 120 | 121 | Header Files 122 | 123 | 124 | Header Files 125 | 126 | 127 | Header Files 128 | 129 | 130 | Header Files 131 | 132 | 133 | Header Files 134 | 135 | 136 | Header Files 137 | 138 | 139 | Header Files 140 | 141 | 142 | 143 | 144 | Source Files 145 | 146 | 147 | Source Files 148 | 149 | 150 | Source Files 151 | 152 | 153 | Source Files 154 | 155 | 156 | Source Files 157 | 158 | 159 | Source Files 160 | 161 | 162 | Source Files 163 | 164 | 165 | Source Files 166 | 167 | 168 | Source Files 169 | 170 | 171 | Source Files 172 | 173 | 174 | Source Files 175 | 176 | 177 | Source Files 178 | 179 | 180 | Source Files 181 | 182 | 183 | Source Files 184 | 185 | 186 | Source Files 187 | 188 | 189 | Source Files 190 | 191 | 192 | Source Files 193 | 194 | 195 | Source Files 196 | 197 | 198 | Source Files 199 | 200 | 201 | Source Files 202 | 203 | 204 | Source Files 205 | 206 | 207 | Source Files 208 | 209 | 210 | Source Files 211 | 212 | 213 | Source Files 214 | 215 | 216 | Source Files 217 | 218 | 219 | Source Files 220 | 221 | 222 | Source Files 223 | 224 | 225 | Source Files 226 | 227 | 228 | -------------------------------------------------------------------------------- /cs2-external-evo.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /fhook/core/core.cpp: -------------------------------------------------------------------------------- 1 | #define WIN32_LEAN_AND_MEAN 2 | 3 | #include "../inc.hpp" 4 | 5 | int main( ) { 6 | SetConsoleTitle( L"unknowncheats.com" ); 7 | 8 | auto process_status = _proc_manager.attach( "cs2.exe" ); 9 | 10 | switch ( process_status ) { 11 | case 1: 12 | goto END; 13 | case 2: 14 | goto END; 15 | case 3: 16 | goto END; 17 | default: 18 | break; 19 | } 20 | 21 | if ( !unknowncheats::framework::m_b_initialized ) 22 | unknowncheats::framework::create( ); 23 | 24 | if ( !unknowncheats::_interfaces->initialize( ) ) { 25 | printf( "[unknowncheats] failtd to init offsets\n" ); 26 | goto END; 27 | } 28 | 29 | printf( "[unknowncheats] initialized interfaces!\n" ); 30 | 31 | if ( !unknowncheats::_address->initialize( ) ) { 32 | printf( "[unknowncheats] failtd to init addresses\n" ); 33 | goto END; 34 | } 35 | 36 | while ( !unknowncheats::framework::unloading ) { 37 | if ( !unknowncheats::framework::render( ) ) 38 | return 0; 39 | 40 | std::this_thread::sleep_for( std::chrono::milliseconds( 1 ) ); 41 | } 42 | 43 | END: 44 | std::cout << std::endl; 45 | system( "pause" ); 46 | return 0; 47 | } -------------------------------------------------------------------------------- /fhook/core/ctx/ctx.cpp: -------------------------------------------------------------------------------- 1 | #include "../../inc.hpp" 2 | 3 | DWORD64 search_for_offset ( std::string Signature, DWORD64 ModuleAddress ) { 4 | std::vector TempAddressList; 5 | DWORD64 Address = 0; 6 | DWORD Offsets = 0; 7 | 8 | TempAddressList = _proc_manager.search_memory( Signature, ModuleAddress, ModuleAddress + 0x4000000 ); 9 | 10 | if ( TempAddressList.size( ) <= 0 ) 11 | return 0; 12 | 13 | if ( !_proc_manager.read_memory( TempAddressList.at( 0 ) + 3, Offsets ) ) 14 | return 0; 15 | 16 | Address = TempAddressList.at( 0 ) + Offsets + 7; 17 | return Address; 18 | } 19 | 20 | using dword = DWORD64; 21 | 22 | bool unknowncheats::interface_t::initialize( ) { 23 | dword client_dll = reinterpret_cast< DWORD64 >( _proc_manager.get_process_module_handle( "client.dll" ) ); 24 | dword server_dll = reinterpret_cast< DWORD64 >( _proc_manager.get_process_module_handle( "server.dll" ) ); 25 | 26 | if ( client_dll == 0 || server_dll == 0 ) { 27 | printf( "[unknowncheats] invalid 1\n" ); 28 | return false; 29 | } 30 | 31 | dword temp = 0; 32 | 33 | /* entity list */ 34 | temp = search_for_offset( unknowncheats::signatures::entity_list, client_dll ); 35 | if ( temp == 0 ) { 36 | printf( "[unknowncheats] invalid unknowncheats::signatures::entity_list\n" ); 37 | return false; 38 | } 39 | 40 | /* dump offset */ 41 | unknowncheats::dragged_offsets::entity_list = temp - client_dll; 42 | 43 | /* local player */ 44 | temp = search_for_offset( unknowncheats::signatures::local_player_controller, client_dll ); 45 | if ( temp == 0 ) { 46 | printf( "[unknowncheats] invalid unknowncheats::signatures::local_player_controller\n" ); 47 | return false; 48 | } 49 | 50 | /* dump offset */ 51 | unknowncheats::dragged_offsets::local_player_controller = temp - client_dll; 52 | 53 | /* view matrix */ 54 | temp = search_for_offset( unknowncheats::signatures::view_matrix, client_dll ); 55 | if ( temp == 0 ) { 56 | printf( "[unknowncheats] invalid unknowncheats::signatures::view_matrix\n" ); 57 | return false; 58 | } 59 | 60 | /* dump offset */ 61 | unknowncheats::dragged_offsets::matrix = temp - client_dll; 62 | 63 | /* global vars */ 64 | temp = search_for_offset( unknowncheats::signatures::global_vars, client_dll ); 65 | if ( temp == 0 ) { 66 | printf( "[unknowncheats] invalid unknowncheats::signatures::global_vars\n" ); 67 | return false; 68 | } 69 | 70 | /* dump offset */ 71 | unknowncheats::dragged_offsets::global_vars = temp - client_dll; 72 | 73 | /* view angle */ 74 | temp = search_for_offset( unknowncheats::signatures::view_angles, client_dll ); 75 | if ( temp == 0 ) { 76 | printf( "[unknowncheats] invalid unknowncheats::signatures::view_angles\n" ); 77 | return false; 78 | } 79 | 80 | /* dump offset */ 81 | unknowncheats::dragged_offsets::view_angle = temp - client_dll; 82 | 83 | /* localpawn */ 84 | temp = search_for_offset( unknowncheats::signatures::local_player_pawn, client_dll ); 85 | if ( temp == 0 ) { 86 | printf( "[unknowncheats] invalid unknowncheats::signatures::local_player_pawn\n" ); 87 | return false; 88 | } 89 | 90 | /* dump offset */ 91 | unknowncheats::dragged_offsets::local_player_pawn = temp + 0x138 - client_dll; 92 | 93 | /* force jump */ 94 | temp = search_for_offset( unknowncheats::signatures::force_jump, client_dll ); 95 | if ( temp == 0 ) { 96 | printf( "[unknowncheats] invalid unknowncheats::signatures::force_jump\n" ); 97 | return false; 98 | } 99 | 100 | /* dump offset */ 101 | unknowncheats::dragged_offsets::force_jump = temp + 0x30 - client_dll; 102 | 103 | /* planted c4 */ 104 | temp = search_for_offset( unknowncheats::signatures::planted_c4, client_dll ); 105 | if ( temp == 0 ) { 106 | printf( "[unknowncheats] invalid unknowncheats::signatures::planted_c4\n" ); 107 | return false; 108 | } 109 | 110 | /* dump offset */ 111 | unknowncheats::dragged_offsets::planted_c4 = temp - client_dll; 112 | 113 | return true; 114 | } 115 | 116 | bool unknowncheats::address_t::initialize( ) { 117 | this->game.client_dll = reinterpret_cast< DWORD64 >( _proc_manager.get_process_module_handle( "client.dll" ) ); 118 | this->game.server_dll = reinterpret_cast< DWORD64 >( _proc_manager.get_process_module_handle( "server.dll" ) ); 119 | 120 | this->game.entity_list = get_client_dll_address( ) + unknowncheats::dragged_offsets::entity_list; 121 | this->game.matrix = get_client_dll_address( ) + unknowncheats::dragged_offsets::matrix; 122 | this->game.view_angle = get_client_dll_address( ) + unknowncheats::dragged_offsets::view_angle; 123 | this->game.local_controller = get_client_dll_address( ) + unknowncheats::dragged_offsets::local_player_controller; 124 | this->game.local_pawn = get_client_dll_address( ) + unknowncheats::dragged_offsets::local_player_pawn; 125 | this->game.server_pawn = get_client_dll_address( ) + unknowncheats::dragged_offsets::local_player_pawn; 126 | this->game.force_jump = get_client_dll_address( ) + unknowncheats::dragged_offsets::force_jump; 127 | this->game.global_vars = get_client_dll_address( ) + unknowncheats::dragged_offsets::global_vars; 128 | 129 | printf( "[unknowncheats] initialized dll addresses!\n" ); 130 | 131 | return this->game.client_dll != 0; 132 | } 133 | 134 | DWORD64 unknowncheats::address_t::get_client_dll_address( ) { 135 | return this->game.client_dll; 136 | } 137 | 138 | DWORD64 unknowncheats::address_t::get_server_dll_address( ) { 139 | return this->game.server_dll; 140 | } 141 | 142 | DWORD64 unknowncheats::address_t::get_entity_list_address( ) { 143 | return this->game.entity_list; 144 | } 145 | 146 | DWORD64 unknowncheats::address_t::get_matrix_address( ) { 147 | return this->game.matrix; 148 | } 149 | 150 | DWORD64 unknowncheats::address_t::get_view_angle_address( ) { 151 | return this->game.view_angle; 152 | } 153 | 154 | DWORD64 unknowncheats::address_t::get_entity_list_entry( ) { 155 | return this->game.entity_list_entry; 156 | } 157 | 158 | DWORD64 unknowncheats::address_t::get_local_controller_address( ) { 159 | return this->game.local_controller; 160 | } 161 | 162 | DWORD64 unknowncheats::address_t::get_local_pawn_address( ) { 163 | return this->game.local_pawn; 164 | } 165 | 166 | DWORD64 unknowncheats::address_t::get_server_pawn_address( ) { 167 | return this->game.server_pawn; 168 | } 169 | 170 | DWORD64 unknowncheats::address_t::get_global_vars_address( ) { 171 | return this->game.global_vars; 172 | } 173 | 174 | bool unknowncheats::address_t::update_entity_list_entry( ) { 175 | DWORD64 entity_list_entry = 0; 176 | 177 | if ( !_proc_manager.read_memory( this->get_entity_list_address( ), entity_list_entry ) ) { 178 | #ifdef read_data_dbg 179 | print_with_data_scoped( "address_t::update_entity_list_entry -> error -> 1" ); 180 | #endif // read_data_dbg 181 | return false; 182 | } 183 | 184 | if ( !_proc_manager.read_memory( entity_list_entry + 0x10, entity_list_entry ) ) { 185 | #ifdef read_data_dbg 186 | print_with_data_scoped( "address_t::update_entity_list_entry -> error -> 2" ); 187 | #endif // read_data_dbg 188 | return false; 189 | } 190 | 191 | this->game.entity_list_entry = entity_list_entry; 192 | 193 | return this->game.entity_list_entry != 0; 194 | } 195 | 196 | bool unknowncheats::address_t::set_view_angle( float yaw, float pitch ) { 197 | vec2_t Angle{ pitch, yaw }; 198 | 199 | if ( !_proc_manager.write_memory( this->game.view_angle, Angle ) ) 200 | return false; 201 | 202 | return false; 203 | } 204 | 205 | bool unknowncheats::address_t::set_force_jump( int value ) { 206 | if ( !_proc_manager.write_memory( this->game.force_jump, value ) ) 207 | return false; 208 | 209 | return true; 210 | } 211 | 212 | bool unknowncheats::address_t::get_force_jump( int& value ) { 213 | if ( !_proc_manager.read_memory( this->game.force_jump, value ) ) 214 | return false; 215 | 216 | return true; 217 | } 218 | -------------------------------------------------------------------------------- /fhook/core/ctx/ctx.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class interface_t { 5 | public: 6 | bool initialize( ); 7 | }; 8 | 9 | class address_t { 10 | public: 11 | bool initialize( ); 12 | 13 | view_t view; 14 | private: 15 | struct { 16 | DWORD64 server_dll; 17 | DWORD64 client_dll; 18 | DWORD64 entity_list; 19 | DWORD64 matrix; 20 | DWORD64 view_angle; 21 | DWORD64 entity_list_entry; 22 | DWORD64 local_controller; 23 | DWORD64 local_pawn; 24 | DWORD64 server_pawn; 25 | DWORD64 force_jump; 26 | DWORD64 global_vars; 27 | 28 | } game; 29 | public: 30 | DWORD64 get_client_dll_address( ); 31 | DWORD64 get_server_dll_address( ); 32 | DWORD64 get_entity_list_address( ); 33 | DWORD64 get_matrix_address( ); 34 | DWORD64 get_view_angle_address( ); 35 | DWORD64 get_entity_list_entry( ); 36 | DWORD64 get_local_controller_address( ); 37 | DWORD64 get_local_pawn_address( ); 38 | DWORD64 get_server_pawn_address( ); 39 | DWORD64 get_global_vars_address( ); 40 | 41 | bool update_entity_list_entry( ); 42 | 43 | bool set_view_angle( float yaw, float pitch ); 44 | 45 | bool set_force_jump( int value ); 46 | bool get_force_jump( int& value ); 47 | 48 | }; 49 | 50 | inline const auto _interfaces = std::make_unique< interface_t>( ); 51 | inline const auto _address = std::make_unique< address_t>( ); 52 | } -------------------------------------------------------------------------------- /fhook/framework/config/cfg.cpp: -------------------------------------------------------------------------------- 1 | #include "../../inc.hpp" 2 | 3 | bool unknowncheats::settings_t::save( std::string file_name ) { 4 | std::string file_path = "C:\\cs2_internal\\" + file_name + ".cfg"; 5 | 6 | std::fstream file( file_path, std::ios::out | std::ios::in | std::ios::trunc ); 7 | file.close( ); 8 | 9 | file.open( file_path, std::ios::out | std::ios::in ); 10 | if ( !file.is_open( ) ) { 11 | file.close( ); 12 | return false; 13 | } 14 | 15 | const size_t settings_size = sizeof( unknowncheats::settings_t ); 16 | for ( int i = 0; i < settings_size; i++ ) { 17 | byte current_byte = *reinterpret_cast< byte* >( uintptr_t( this ) + i ); 18 | for ( int x = 0; x < 8; x++ ) { 19 | file << ( int )( ( current_byte >> x ) & 1 ); 20 | } 21 | } 22 | 23 | file.close( ); 24 | 25 | return true; 26 | } 27 | 28 | bool unknowncheats::settings_t::load( std::string file_name ) { 29 | CreateDirectory( L"C:\\cs2_internal", NULL ); 30 | std::string file_path = "C:\\cs2_internal\\" + file_name + ".cfg"; 31 | 32 | std::fstream file; 33 | file.open( file_path, std::ios::out | std::ios::in ); 34 | if ( !file.is_open( ) ) { 35 | file.close( ); 36 | return false; 37 | } 38 | 39 | std::string line; 40 | while ( file ) { 41 | std::getline( file, line ); 42 | 43 | const size_t settings_size = sizeof( unknowncheats::settings_t ); 44 | if ( line.size( ) > settings_size * 8 ) { 45 | file.close( ); 46 | return false; 47 | } 48 | for ( int i = 0; i < settings_size; i++ ) { 49 | byte current_byte = *reinterpret_cast< byte* >( uintptr_t( this ) + i ); 50 | for ( int x = 0; x < 8; x++ ) { 51 | if ( line[ ( i * 8 ) + x ] == '1' ) 52 | current_byte |= 1 << x; 53 | else 54 | current_byte &= ~( 1 << x ); 55 | } 56 | *reinterpret_cast< byte* >( uintptr_t( this ) + i ) = current_byte; 57 | } 58 | } 59 | 60 | file.close( ); 61 | 62 | return true; 63 | } 64 | -------------------------------------------------------------------------------- /fhook/framework/config/cfg.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class settings_t { 5 | public: 6 | bool save( std::string file_name ); 7 | bool load( std::string file_name ); 8 | 9 | /* variables */ 10 | bool bounding_box = false; 11 | float box_color[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 12 | float box_color_inv[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 13 | 14 | bool dormancy = false; 15 | bool name_esp = false; 16 | float name_color[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 17 | float name_color_a[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 18 | float name_color_inv[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 19 | int name_at = 0; 20 | bool name_animation = false; 21 | 22 | bool health_bar = false; 23 | bool customhealthbar = false; 24 | float healthbar[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 25 | float healthbari[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 26 | 27 | bool ammobar = false; 28 | float ammobar_color[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 29 | float ammobar_color_inv[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 30 | 31 | bool eap = false; 32 | float eap_color[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 33 | float eap_color_inv[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 34 | 35 | bool bones_h = false; 36 | bool bones = false; 37 | float bone_color[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 38 | float bone_color_inv[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 39 | 40 | bool flags = false; 41 | 42 | bool show_competivie_wins = false; 43 | bool show_dmg_dealt = false; 44 | 45 | bool change_by_visibility = false; 46 | 47 | 48 | /* triggerbot */ 49 | bool triggerbot = false; 50 | int activationz_type = 0; // hold - toggle - always on 51 | int triggerkey = 1; 52 | 53 | int reaction_time = 0; 54 | int shot_delay = 0; 55 | 56 | bool aimbot = false; 57 | float fov = 0; 58 | float smooth = 0; 59 | int aim_distance_max = 200; 60 | bool visible_check = true; // autowall 61 | int hitbox = 0; 62 | bool draw_fov = false; 63 | float fov_color[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 64 | 65 | /* other shit for legitbot */ 66 | bool legitbot_stuff[ 50 ]; 67 | int legitbot_stuff_int[ 50 ]; 68 | float legitbot_stuff_float[ 50 ]; 69 | 70 | int a_activationz_type = 0; // hold - toggle - always on 71 | int a_triggerkey = 29; 72 | 73 | bool rage = false; 74 | int rage_fov = 10; 75 | bool ignore_wall = true; 76 | int rage_hitbox = 0; 77 | 78 | bool change_smoke = false; 79 | float smoke_coloringol[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 80 | 81 | bool remove_smoke = false; 82 | 83 | 84 | int ragebot_spot_type; 85 | bool ignore_if_Distance_tO_high; 86 | int distance_to_rage; 87 | 88 | bool ragebot_stuff[ 50 ]; 89 | int ragebot_stuff2[ 50 ]; 90 | float ragebot_stuff3[ 50 ]; 91 | 92 | bool local_sound = false; 93 | bool enemy_sound = false; 94 | 95 | int local_range = 30; 96 | int enemy_range = 30; 97 | 98 | float sound_animation_speed_l = 0.1f; 99 | float sound_animation_speed_e = 0.1f; 100 | 101 | float sound_col_l[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 102 | float sound_col_e[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 103 | 104 | 105 | bool flash_builder = false; 106 | bool remove_full_flash = false; 107 | float flash_alpha = 255.f; 108 | float flash_time = 0.5f; 109 | 110 | bool killedby_hs = false; 111 | 112 | bool hitsound = false; 113 | bool hitsounduh = false; 114 | int hitsound_type = 0; 115 | bool hitmarker = false; 116 | float hitmarker_col[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; 117 | 118 | bool visuals_b[ 120 ]{ false }; 119 | int visuals_i[ 120 ]{ 0 }; 120 | float visuals_c[120][ 4 ]{ 1.0f, 1.0f, 1.0f, 1.0f }; 121 | }; 122 | 123 | inline const auto _settings = std::make_unique< settings_t >( ); 124 | } -------------------------------------------------------------------------------- /fhook/framework/framework.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | namespace framework { 5 | inline bool m_b_initialized = false; 6 | inline bool unloading = false; 7 | inline bool m_b_open = false; 8 | inline int m_i_width = 1920; 9 | inline int m_i_height = 1080; 10 | inline unsigned int m_u_refresh_rate = 60; 11 | 12 | inline ID3D11Device* p_device = nullptr; 13 | inline ID3D11DeviceContext* p_context = nullptr; 14 | inline IDXGISwapChain* p_swap_chain = nullptr; 15 | inline ID3D11RenderTargetView* p_render_target_view = nullptr; 16 | 17 | inline WNDCLASSEXW window_class = { }; 18 | inline HWND instance{ nullptr }; 19 | inline HMODULE h_moudle{ nullptr }; 20 | 21 | bool create( ); 22 | bool render( ); 23 | void destroy( ); 24 | } 25 | 26 | class menu_t { 27 | public: 28 | void render( ); 29 | void initialize( ); 30 | }; 31 | 32 | inline const auto _menu = std::make_unique< menu_t >( ); 33 | } 34 | -------------------------------------------------------------------------------- /fhook/hacks/ctx/hacks_ctx.cpp: -------------------------------------------------------------------------------- 1 | #include "hacks_ctx.hpp" 2 | #include "../../inc.hpp" 3 | #include "../../sdk/animation_system/animation_system.hpp" 4 | 5 | unknowncheats::c_entity* get_entity( int index ) { // just leave it like that 6 | unknowncheats::c_entity* ent = ( unknowncheats::c_entity* )( unknowncheats::_address->get_entity_list_entry() + 0x78 * ( index + 1 ) ); 7 | return ent; 8 | } 9 | 10 | void unknowncheats::hacks_t::run( ) { 11 | /* update matrix */ 12 | if ( !_proc_manager.read_memory( unknowncheats::_address->get_matrix_address( ), unknowncheats::_address->view.matrix, 64 ) ) { 13 | #ifdef read_data_dbg 14 | print_with_data_scoped( "hacks_t::run -> error -> read_memory::get_matrix_address" ); 15 | #endif // read_data_dbg 16 | return; 17 | } 18 | 19 | /* update entity list entry */ 20 | unknowncheats::_address->update_entity_list_entry( ); 21 | 22 | /* local player stuff */ 23 | DWORD64 local_player_adr = 0; 24 | DWORD64 local_pawn_adr = 0; 25 | if ( !_proc_manager.read_memory( unknowncheats::_address->get_local_controller_address( ), local_player_adr ) ) { 26 | #ifdef read_data_dbg 27 | print_with_data_scoped( "hacks_t::run -> error -> read_memory::get_local_controller_address" ); 28 | #endif // read_data_dbg 29 | return; 30 | } 31 | 32 | if ( !_proc_manager.read_memory( unknowncheats::_address->get_local_pawn_address( ), local_pawn_adr ) ) { 33 | #ifdef read_data_dbg 34 | print_with_data_scoped( "hacks_t::run -> error -> read_memory::get_local_pawn_address" ); 35 | #endif // read_data_dbg 36 | return; 37 | } 38 | 39 | unknowncheats::c_entity local_player; 40 | static int local_player_index = 1; 41 | 42 | if ( !local_player.update_controller( local_player_adr ) ) { 43 | #ifdef read_data_dbg 44 | print_with_data_scoped( "hacks_t::run -> error -> update_controller::local_player_adr" ); 45 | #endif // read_data_dbg 46 | return; 47 | } 48 | 49 | if ( !local_player.update_pawn( local_pawn_adr ) ) { 50 | #ifdef read_data_dbg 51 | print_with_data_scoped( "hacks_t::run -> error -> update_pawn::local_pawn_adr" ); 52 | #endif // read_data_dbg 53 | return; 54 | } 55 | 56 | 57 | /* loop between entity */ 58 | for ( int i = 0; i < 64; i++ ) { 59 | c_entity entity; 60 | DWORD64 entity_address = 0; 61 | 62 | if ( !_proc_manager.read_memory( unknowncheats::_address->get_entity_list_entry( ) + ( i + 1 ) * 0x78, entity_address ) ) { 63 | #ifdef read_data_dbg1 64 | print_with_data_scoped( "hacks_t::run -> error -> loop::get_entity_list_entry" ); 65 | #endif // read_data_dbg 66 | continue; 67 | } 68 | 69 | if ( entity_address == local_player.controller.address ) { 70 | local_player_index = i; 71 | continue; 72 | } 73 | 74 | if ( !entity.update_controller( entity_address ) ) { 75 | #ifdef read_data_dbg1 76 | print_with_data_scoped( "hacks_t::run -> error -> update_controller::entity_address" ); 77 | #endif // read_data_dbg 78 | continue; 79 | } 80 | 81 | if ( !entity.update_pawn( entity.player_pawn.address ) ) { 82 | #ifdef read_data_dbg 83 | print_with_data_scoped( "hacks_t::run -> error -> update_pawn::entity.player_pawn.address" ); 84 | #endif // read_data_dbg 85 | continue; 86 | } 87 | 88 | if ( entity.controller.team_id == local_player.controller.team_id ) { 89 | continue; 90 | } 91 | 92 | if ( !entity.in_screen( ) ) { 93 | continue; 94 | } 95 | 96 | unknowncheats::col_t col = unknowncheats::col_t( 255, 0, 0 ); 97 | _proc_manager.write_memory( entity.player_pawn.address + 0xA73, col ); 98 | 99 | _shots->hitmarker( entity, local_player ); 100 | 101 | bool is = true; 102 | bool smth; 103 | float smth3; 104 | int smth4; 105 | DWORD64 smth2; 106 | 107 | 108 | #if 0 109 | #define int_3 110 | #ifdef int_ 111 | _proc_manager.read_memory( local_player.player_pawn.address + 0x1537, smth4 ); 112 | #elif defined(int_2) 113 | _proc_manager.read_memory( local_player.player_pawn.address + 0x15BC, smth3 ); 114 | #elif defined(int_3) 115 | _proc_manager.read_memory( entity.player_pawn.address + 0x1668, smth ); 116 | #endif 117 | 118 | #ifdef int_ 119 | if ( GetKeyState( VK_F2 ) ) 120 | print_with_data_scoped( "s: " + std::to_string( smth4 ) ) 121 | #elif defined(int_2) 122 | if ( GetKeyState( VK_F2 ) ) 123 | print_with_data_scoped( "s: " + std::to_string( smth3 ) ) 124 | #elif defined(int_3) 125 | if ( GetKeyState( VK_F2 ) ) 126 | print_with_data_scoped( "s: " + std::to_string( smth ) ) 127 | #endif 128 | #endif 129 | 130 | _sound->push_sound2( entity, i ); 131 | 132 | _legit->run_aimbot( entity, local_player, local_player.player_pawn.camera_pos, i, local_player_index ); 133 | _rage->run_aimbot( entity, local_player, local_player.player_pawn.camera_pos, i, local_player_index ); 134 | 135 | ImVec4 rect = unknowncheats::_esp->get_player_bounding_box( entity ); 136 | unknowncheats::_esp->render_esp( local_player, entity, rect, local_player_index, i ); 137 | unknowncheats::_esp->killed_by_hs( entity, i ); 138 | } 139 | 140 | /* loop between other entity */ 141 | for ( int i_smoke = 64; i_smoke < 1024; i_smoke++ ) { 142 | uintptr_t ent = ( uintptr_t )get_entity( i_smoke ); 143 | 144 | if ( ent == 0 ) { 145 | #ifdef read_data_dbg 146 | print_with_data_scoped( "hacks_t::run2 -> error -> loop::continue - 1024 [ 0 ]" ); 147 | #endif // read_data_dbg 148 | continue; 149 | } 150 | 151 | unknowncheats::_esp->change_smoke_color( ent ); 152 | unknowncheats::_esp->remove_smoke( ent ); 153 | } 154 | 155 | _legit->draw_aimbot_fov( ); 156 | _sound->push_sound( local_player ); 157 | _flash->run_flash_builder( local_player ); 158 | _shots->hitsound( local_player ); 159 | 160 | /* 161 | scoped: _proc_manager.read_memory( local_player.player_pawn.address + 0x13A8, smth ); 162 | defusing: _proc_manager.read_memory( local_player.player_pawn.address + 0x13B0, smth ); 163 | grabbing_hostage: _proc_manager.read_memory( local_player.player_pawn.address + 0x13B1, smth ); 164 | gungame_imunity: _proc_manager.read_memory( local_player.player_pawn.address + 0x13C4, smth ); 165 | 166 | shots fired, calc 1 shot, when u do shot : local_player.player_pawn.address + 0x1420 167 | is_flashed: _proc_manager.read_memory( local_player.player_pawn.address + 0x145C, smth3 ); // smth3 > 0 168 | 169 | */ 170 | 171 | 172 | 173 | 174 | static int prev_total_hits; 175 | bool total_hits; 176 | float minexp; 177 | bool on = true; 178 | float min = 0.15; 179 | 180 | uintptr_t bullet_services; 181 | 182 | //_proc_manager.read_memory( local_player.controller.address + 0x1F4, bullet_services ); 183 | //_proc_manager.read_memory( bullet_services + 0xD04, total_hits ); 184 | //_proc_manager.read_memory( bullet_services + 0xD0C, minexp ); 185 | 186 | 187 | //_proc_manager.write_memory( bullet_services + 0xCEC, min ); 188 | 189 | 190 | 191 | bool is = true; 192 | bool smth; 193 | float smth3; 194 | int smth4; 195 | 196 | #if 0 197 | #define int_2 198 | #ifdef int_ 199 | _proc_manager.read_memory( local_player.player_pawn.address + 0x1537, smth4 ); 200 | #elif defined(int_2) 201 | _proc_manager.read_memory( local_player.player_pawn.address + 0x15BC, smth3 ); 202 | #elif defined(int_3) 203 | _proc_manager.read_memory( local_player.player_pawn.address + 0x1537, smth ); 204 | #endif 205 | 206 | #ifdef int_ 207 | if ( GetKeyState( VK_F2 ) ) 208 | print_with_data_scoped( "s: " + std::to_string( smth4 ) ) 209 | #elif defined(int_2) 210 | if ( GetKeyState( VK_F2 ) ) 211 | print_with_data_scoped( "s: " + std::to_string( smth3 ) ) 212 | #elif defined(int_3) 213 | if ( GetKeyState( VK_F2 ) ) 214 | print_with_data_scoped( "s: " + std::to_string( smth ) ) 215 | #endif 216 | #endif 217 | float fl = 0.5f; 218 | //_proc_manager.write_memory( local_player.player_pawn.address + 0x15C0, fl ); 219 | //_proc_manager.write_memory( local_player.player_pawn.address + 0x1464, fl ); 220 | 221 | #if 0 222 | if ( smth ) { 223 | printf( "yes\n" ); 224 | } else { 225 | printf( "no\n" ); 226 | } 227 | #endif 228 | 229 | 230 | /* trigger bot */ 231 | if ( _settings->triggerbot ) { 232 | switch ( _settings->activationz_type ) { 233 | case 0: /* hold */ 234 | { 235 | if ( GetAsyncKeyState( _input_key->get_bind_id( _settings->triggerkey ) ) ) { 236 | _triggerbot->run_trigger( local_player ); 237 | } 238 | } break; 239 | case 1: /* toggle */ 240 | { 241 | if ( GetKeyState( _input_key->get_bind_id( _settings->triggerkey ) ) ) { 242 | _triggerbot->run_trigger( local_player ); 243 | } 244 | } break; 245 | case 2: /* always on */ 246 | { 247 | _triggerbot->run_trigger( local_player ); 248 | } break; 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /fhook/hacks/ctx/hacks_ctx.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace unknowncheats { 5 | class hacks_t { 6 | public: 7 | void run( ); 8 | }; 9 | 10 | inline const auto _hacks = std::make_unique< hacks_t >( ); 11 | } -------------------------------------------------------------------------------- /fhook/hacks/features/esp/esp.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class esp_t { 5 | public: 6 | void setup_alpha( const c_entity& local_player, const c_entity& entity, int local_index, int index ); 7 | 8 | void bounding_box( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 9 | void render_name( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 10 | void health_bar( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 11 | void ammo_bar( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 12 | void render_weapon( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 13 | void skeleton_esp( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 14 | void render_side_info( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 15 | void render_dropped_esp( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 16 | void render_distance( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 17 | void render_taser_range( const c_entity& local_player, const c_entity& entity, ImVec4 rect, int local_index, int index ); 18 | void change_smoke_color( uintptr_t ent ); 19 | void remove_smoke( uintptr_t ent ); 20 | void render_incendiary( ); 21 | void killed_by_hs( const c_entity& entity, int i ); 22 | 23 | void render_esp( const c_entity& local_player, const c_entity& entity, ImVec4 rect, 24 | int local_index, int index ); 25 | 26 | unknowncheats::macros::vec4_t get_player_bounding_box( const c_entity& entity ); 27 | 28 | bool spotted( const c_entity& entity, const c_entity& local_player, int local_index, int index ) { 29 | return ( ( entity.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << local_index ) ) 30 | || ( local_player.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << index ) ) ); 31 | } 32 | 33 | bool l_spotted( const c_entity& entity, const c_entity& local_player, int local_index, int index ) { 34 | return ( ( entity.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << local_index ) ) ); 35 | } 36 | 37 | bool e_spotted( const c_entity& entity, const c_entity& local_player, int local_index, int index ) { 38 | return ( ( local_player.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << index ) ) ); 39 | } 40 | private: 41 | float esp_alpha[64]; /* max entity index */ 42 | }; 43 | 44 | inline const auto _esp = std::make_unique( ); 45 | } -------------------------------------------------------------------------------- /fhook/hacks/features/flash_builder/flash_builder.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | 3 | void unknowncheats::flash_builder::run_flash_builder( const c_entity& entity ) { 4 | if ( !_settings->flash_builder ) 5 | return; 6 | 7 | if ( !_settings->remove_full_flash ) { 8 | float fl = _settings->flash_alpha; 9 | float fl_t = _settings->flash_time; 10 | _proc_manager.write_memory( entity.player_pawn.address + offsets::pawn::max_alpha, fl ); /* xref: m_flFlashMaxAlpha */ 11 | _proc_manager.write_memory( entity.player_pawn.address + offsets::pawn::flash_Duration, fl_t ); /* xref: m_flFlashDuration */ 12 | 13 | } else { 14 | // xref: m_flFlashBangTime 15 | float fl = 0.f; 16 | _proc_manager.write_memory( entity.player_pawn.address + offsets::pawn::flashbang_time, fl ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fhook/hacks/features/flash_builder/flash_builder.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class flash_builder { 5 | public: 6 | void run_flash_builder( const c_entity& entity ); 7 | }; 8 | 9 | inline const auto _flash = std::make_unique< flash_builder >( ); 10 | } -------------------------------------------------------------------------------- /fhook/hacks/features/grenade/grenades.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | -------------------------------------------------------------------------------- /fhook/hacks/features/grenade/grenades.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fhook/hacks/features/legitbot/legitbot.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | #include "../../../sdk/animation_system/animation_system.hpp" 3 | 4 | void unknowncheats::legit_t::run_aimbot( const c_entity& entity, const c_entity& local, vec3_t local_pos, int ent_idx, int local_idx ) { 5 | float yaw, pitch, distance, norm, lenght; 6 | vec3_t opp_pos; 7 | vec2_t angles{}; 8 | int screen_center_x = 1920 / 2; 9 | int screen_center_y = 1080 / 2; 10 | 11 | /* hacks_ctx.cpp */ 12 | float distance_to_sight = 0; 13 | float max_aim_distance = 1500; 14 | vec3_t aim_pos{ 0, 0, 0 }; 15 | 16 | bool body_if_lethal = _settings->legitbot_stuff[ 9 ] && local.player_pawn.health < 30; 17 | 18 | /* hitbox shit */ 19 | if ( !body_if_lethal ) { 20 | switch ( unknowncheats::_settings->hitbox ) { 21 | case 0: 22 | { 23 | _legit->aim_position = bone_index::head; 24 | } break; 25 | case 1: 26 | { 27 | _legit->aim_position = bone_index::neck_0; 28 | } break; 29 | case 2: 30 | { 31 | _legit->aim_position = bone_index::spine_1; 32 | } break; 33 | case 3: 34 | { 35 | _legit->aim_position = bone_index::pelvis; 36 | } break; 37 | } 38 | } else if ( body_if_lethal ) { 39 | _legit->aim_position = bone_index::pelvis; 40 | } 41 | 42 | distance_to_sight = entity.get_bone( ).bone_pos_list[ bone_index::head ].screen_pos.dist_to( { ( 1920 / 2 ), ( 1080 / 2 ) } ); 43 | if ( distance_to_sight < max_aim_distance ) { 44 | max_aim_distance = distance_to_sight; 45 | 46 | if ( !_settings->visible_check || entity.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << ( local_idx ) ) || local.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << ( ent_idx ) ) ) { 47 | aim_pos = entity.get_bone( ).bone_pos_list[ _legit->aim_position ].pos; 48 | 49 | if ( _legit->aim_position == bone_index::head ) 50 | aim_pos.z -= 1.f; 51 | } 52 | } 53 | 54 | //bool[9] // last used 55 | 56 | /* dinamic scale will work when u use the aimbot */ 57 | bool use_dinamic_while_moving = _settings->legitbot_stuff[ 1 ] && entity.player_pawn.vec_velocity.length( ) > 50.f; 58 | bool use_dinamic_while_player_lethal = _settings->legitbot_stuff[ 2 ] && entity.player_pawn.health < 30; 59 | bool use_dinamic_while_local_is_lethal = _settings->legitbot_stuff[ 3 ] && local.player_pawn.health < 30; 60 | bool use_dinamic_while_good_player = _settings->legitbot_stuff[ 7 ] && entity.controller.total_dmg > _settings->legitbot_stuff_int[0]; 61 | static float dinamic_scale[4]; /* run this static, whatever */ 62 | 63 | /* dinamic smooth */ 64 | bool use_dinamic_smoth_1 = _settings->legitbot_stuff[ 5 ] && entity.player_pawn.vec_velocity.length( ) > 50.f; 65 | bool use_dinamic_smoth_2 = _settings->legitbot_stuff[ 6 ] && local.player_pawn.health < 30; 66 | bool use_dinamic_while_good_player2 = _settings->legitbot_stuff[ 8 ] && entity.controller.total_dmg > _settings->legitbot_stuff_int[ 2 ]; 67 | static float dinamic_smooth[ 3 ]; /* run this static, whatever */ 68 | 69 | if ( _settings->aimbot ) { 70 | switch ( _settings->a_activationz_type ) { 71 | case 0: /* hold */ 72 | { 73 | if ( !GetAsyncKeyState( _input_key->get_bind_id( _settings->a_triggerkey ) ) ) { 74 | dinamic_scale[ 0 ] = 0.f; /* reset */ 75 | dinamic_scale[ 1 ] = 0.f; /* reset */ 76 | dinamic_scale[ 2 ] = 0.f; /* reset */ 77 | dinamic_scale[ 3 ] = 0.f; /* reset */ 78 | this->dinamic_csale = 0.f; 79 | 80 | dinamic_smooth[ 0 ] = 0.f; 81 | dinamic_smooth[ 1 ] = 0.f; 82 | dinamic_smooth[ 2 ] = 0.f; 83 | this->dinamic_smoth = 0.f; 84 | 85 | return; 86 | } 87 | } break; 88 | case 1: /* toggle */ 89 | { 90 | if ( !GetKeyState( _input_key->get_bind_id( _settings->a_triggerkey ) ) ) { 91 | dinamic_scale[ 0 ] = 0.f; /* reset */ 92 | dinamic_scale[ 1 ] = 0.f; /* reset */ 93 | dinamic_scale[ 2 ] = 0.f; /* reset */ 94 | dinamic_scale[ 3 ] = 0.f; /* reset */ 95 | this->dinamic_csale = 0.f; 96 | 97 | dinamic_smooth[ 0 ] = 0.f; 98 | dinamic_smooth[ 1 ] = 0.f; 99 | dinamic_smooth[ 2 ] = 0.f; 100 | this->dinamic_smoth = 0.f; 101 | return; 102 | } 103 | } break; 104 | case 2: /* always on */ 105 | { 106 | /* shit is always on*/ 107 | } break; 108 | } 109 | } else if ( !_settings->aimbot ) { 110 | return; 111 | } 112 | 113 | /* paste fix */ 114 | if ( aim_pos == vec3_t( 0, 0, 0 ) ) { 115 | dinamic_scale[0] = 0.f; /* reset */ 116 | dinamic_scale[1] = 0.f; /* reset */ 117 | dinamic_scale[2] = 0.f; /* reset */ 118 | dinamic_scale[3] = 0.f; /* reset */ 119 | this->dinamic_csale = 0.f; 120 | 121 | dinamic_smooth[ 0 ] = 0.f; 122 | dinamic_smooth[ 1 ] = 0.f; 123 | dinamic_smooth[ 2 ] = 0.f; 124 | this->dinamic_smoth = 0.f; 125 | return; 126 | } 127 | 128 | if ( framework::m_b_open ) { 129 | dinamic_scale[ 0 ] = 0.f; /* reset */ 130 | dinamic_scale[ 1 ] = 0.f; /* reset */ 131 | dinamic_scale[ 2 ] = 0.f; /* reset */ 132 | dinamic_scale[ 3 ] = 0.f; /* reset */ 133 | this->dinamic_csale = 0.f; 134 | 135 | dinamic_smooth[ 0 ] = 0.f; 136 | dinamic_smooth[ 1 ] = 0.f; 137 | dinamic_smooth[ 2 ] = 0.f; 138 | this->dinamic_smoth = 0.f; 139 | return; 140 | } 141 | 142 | if ( entity.player_pawn.health <= 0 ) { 143 | dinamic_scale[ 0 ] = 0.f; /* reset */ 144 | dinamic_scale[ 1 ] = 0.f; /* reset */ 145 | dinamic_scale[ 2 ] = 0.f; /* reset */ 146 | dinamic_scale[ 3 ] = 0.f; /* reset */ 147 | this->dinamic_csale = 0.f; 148 | 149 | dinamic_smooth[ 0 ] = 0.f; 150 | dinamic_smooth[ 1 ] = 0.f; 151 | dinamic_smooth[ 2 ] = 0.f; 152 | this->dinamic_smoth = 0.f; 153 | return; 154 | } 155 | 156 | if ( _settings->legitbot_stuff[ 0 ] ) { /* dinamic fov */ 157 | /* some conditions so we dont overrun this shit */ 158 | if ( use_dinamic_while_moving ) { 159 | /* enemy is moving that is not that much of bullshit */ 160 | dinamic_scale[ 0 ] = 1.f; /* just 1.f added to fov, since he is moving, thats not much shit to do */ 161 | } else { 162 | dinamic_scale[ 0 ] = 0.0f; /* reset it */ 163 | } 164 | 165 | if ( use_dinamic_while_player_lethal ) { 166 | /* player is lethal, so we might want to hit it easier, we are going to add 1.3f */ 167 | dinamic_scale[ 1 ] = 1.3f; /* just add to fov */ 168 | } else { 169 | dinamic_scale[ 1 ] = 0.0f; /* just add to fov */ 170 | } 171 | 172 | if ( use_dinamic_while_local_is_lethal ) { 173 | /* local is lethal, so we might want to hit it easier, we are going to add 0.5f */ 174 | dinamic_scale[ 2 ] = 0.5f; /* just add to fov */ 175 | } else { 176 | dinamic_scale[ 2 ] = 0.f; 177 | } 178 | 179 | if ( use_dinamic_while_good_player ) { 180 | /* player is lethal, so we might want to hit it easier, we are going to add 1.3f */ 181 | dinamic_scale[ 3 ] = 1.f; /* just add to fov */ 182 | } else { 183 | dinamic_scale[ 3 ] = 0.0f; /* just add to fov */ 184 | } 185 | 186 | this->dinamic_csale = dinamic_scale[ 0 ] + dinamic_scale[ 1 ] + dinamic_scale[ 2 ]; 187 | } 188 | 189 | /* reset if this is off */ 190 | if ( !_settings->legitbot_stuff[ 0 ] ) { 191 | dinamic_scale[ 0 ] = 0.f; /* reset */ 192 | dinamic_scale[ 1 ] = 0.f; /* reset */ 193 | dinamic_scale[ 2 ] = 0.f; /* reset */ 194 | this->dinamic_csale = 0.f; 195 | } 196 | 197 | /* dinamic smooth */ 198 | if ( _settings->legitbot_stuff[ 4 ] ) { 199 | /* some conditions so we dont overrun this shit */ 200 | if ( use_dinamic_smoth_1 ) { 201 | /* enemy is moving that is not that much of bullshit */ 202 | dinamic_smooth[ 0 ] = 0.2f; /* just 1.f added to fov, since he is moving, thats not much shit to do */ 203 | } else { 204 | dinamic_smooth[ 0 ] = 0.0f; /* reset it */ 205 | } 206 | 207 | if ( use_dinamic_smoth_2 ) { 208 | /* player is lethal, so we might want to hit it easier, we are going to add 1.3f */ 209 | dinamic_smooth[ 1 ] = 0.2f; /* just add to fov */ 210 | } else { 211 | dinamic_smooth[ 1 ] = 0.0f; /* just add to fov */ 212 | } 213 | 214 | if ( use_dinamic_while_good_player2 ) { 215 | /* player is lethal, so we might want to hit it easier, we are going to add 1.3f */ 216 | dinamic_smooth[ 2 ] = 0.2f; /* just add to fov */ 217 | } else { 218 | dinamic_smooth[ 2 ] = 0.0f; /* just add to fov */ 219 | } 220 | 221 | this->dinamic_smoth = dinamic_smooth[ 0 ] + dinamic_smooth[ 1 ]; 222 | } 223 | 224 | if ( !_settings->legitbot_stuff[ 4 ] ) { 225 | dinamic_smooth[ 0 ] = 0.f; 226 | dinamic_smooth[ 1 ] = 0.f; 227 | this->dinamic_smoth = 0.f; 228 | } 229 | 230 | /* fix */ 231 | opp_pos = aim_pos - local_pos; 232 | distance = sqrt( pow( opp_pos.x, 2 ) + pow( opp_pos.y, 2 ) ); 233 | lenght = sqrt( distance * distance + opp_pos.z * opp_pos.z ); 234 | 235 | yaw = atan2f( opp_pos.y, opp_pos.x ) * 57.295779513 - local.player_pawn.viewangle.y; 236 | pitch = -atan( opp_pos.z / distance ) * 57.295779513 - local.player_pawn.viewangle.x; 237 | norm = sqrt( pow( yaw, 2 ) + pow( pitch, 2 ) ); 238 | 239 | vec2_t screen_pos; 240 | _address->view.world_to_screen( vec3_t( aim_pos ), screen_pos ); 241 | 242 | if ( norm >= ( _settings->fov + this->dinamic_csale ) ) { 243 | return; // If condition not met, exit early 244 | } 245 | 246 | float smooth_factor = ( ( _settings->smooth - this->dinamic_smoth ) != 0.0f ) ? ( _settings->smooth - this->dinamic_smoth ) : 1.5f; 247 | 248 | auto calculate_target = [ ]( int screen_pos, int screen_center, float smooth ) { 249 | return ( screen_pos != screen_center ) ? ( ( screen_pos > screen_center ) ? -( screen_center - screen_pos ) : ( screen_pos - screen_center ) ) / smooth : 0; 250 | }; 251 | 252 | float target_x = calculate_target( screen_pos.x, screen_center_x, smooth_factor ); 253 | float target_y = ( screen_pos.y != screen_center_y && screen_pos.y != 0 ) ? calculate_target( screen_pos.y, screen_center_y, smooth_factor ) : 0; 254 | 255 | if ( !_settings->smooth ) { 256 | mouse_event( MOUSEEVENTF_MOVE, target_x, target_y, NULL, NULL ); 257 | return; 258 | } 259 | 260 | float distance_ratio = norm / ( _settings->fov + this->dinamic_csale ); 261 | float speed_factor = 1.0f + ( 1.0f - distance_ratio ); 262 | 263 | target_x = calculate_target( screen_pos.x, screen_center_x, smooth_factor ) / ( ( _settings->smooth - this->dinamic_smoth ) * speed_factor ); 264 | target_y = ( screen_pos.y != screen_center_y && screen_pos.y != 0 ) ? calculate_target( screen_pos.y, screen_center_y, smooth_factor ) / ( ( _settings->smooth - this->dinamic_smoth ) * speed_factor ) : 0; 265 | 266 | mouse_event( MOUSEEVENTF_MOVE, target_x, target_y, NULL, NULL ); 267 | 268 | } 269 | 270 | void unknowncheats::legit_t::draw_aimbot_fov( ) { 271 | if ( !_settings->draw_fov ) { 272 | return; 273 | } 274 | 275 | float screen_x = GetSystemMetrics( SM_CXSCREEN ) / 2.f; 276 | float screen_y = GetSystemMetrics( SM_CYSCREEN ) / 2.f; 277 | 278 | /* run animation */ 279 | auto animation = animation_controller.get( "animation_fov" + std::to_string( 0 ) + animation_controller.current_child ); 280 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( 1.f ) * ( ( this->dinamic_csale > 0.f ) ? 1.f : -1.f ) ); 281 | 282 | _render->add_circle( unknowncheats::vec2_t( screen_x, screen_y ), ( ( _settings->fov + this->dinamic_csale * animation.value ) * 10 ), _render->to_main_color( _settings->fov_color ) ); 283 | } 284 | -------------------------------------------------------------------------------- /fhook/hacks/features/legitbot/legitbot.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class legit_t { 5 | public: 6 | void run_aimbot( const c_entity& entity, const c_entity& local, vec3_t local_pos, int ent_idx, int local_idx ); 7 | void draw_aimbot_fov( ); 8 | 9 | float dinamic_csale{}, dinamic_smoth{}; 10 | 11 | DWORD aim_position = bone_index::head; 12 | }; 13 | 14 | inline const auto _legit = std::make_unique < legit_t >( ); 15 | } -------------------------------------------------------------------------------- /fhook/hacks/features/ragebot/ragebot.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | 3 | void release_mouse_event_rage( ) { 4 | /* we can now shot so lets do it */ 5 | std::this_thread::sleep_for( std::chrono::milliseconds( unknowncheats::_settings->shot_delay ) ); /* add a custom delay and more */ 6 | mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 ); /* release shot event */ 7 | } 8 | 9 | void unknowncheats::rage_t::run_aimbot( const c_entity& entity, const c_entity& local, vec3_t local_pos, int ent_idx, int local_idx ) { 10 | // gheto ass pasted - aimstar with modifications 11 | if ( !_settings->rage ) 12 | return; 13 | 14 | float yaw, pitch, distance, norm, lenght, target_x, target_y; 15 | vec3_t opp_pos; 16 | vec2_t angles{}; 17 | int screen_center_x = 1920 / 2; 18 | int screen_center_y = 1080 / 2; 19 | 20 | /* hacks_ctx.cpp */ 21 | float distance_to_sight = 0; 22 | float max_aim_distance = 1500; 23 | vec3_t aim_pos{ 0, 0, 0 }; 24 | 25 | float distance_aim = local.player_pawn.vec_origin.dist_to( entity.player_pawn.vec_origin ); 26 | if ( _settings->ignore_if_Distance_tO_high ) { 27 | if ( distance_aim > _settings->distance_to_rage ) { 28 | return; /* do not try for higher distance */ 29 | } 30 | } 31 | 32 | // multipoint [0] 33 | bool b1 = unknowncheats::_settings->ragebot_stuff[ 1 ] && entity.player_pawn.health < 30; 34 | bool entity_lol = entity.player_pawn.health > local.player_pawn.health; 35 | bool b2 = unknowncheats::_settings->ragebot_stuff[ 2 ] && entity_lol; 36 | 37 | if ( _settings->ragebot_stuff[ 0 ] ) { /* thats the multipoint bruther */ 38 | 39 | if ( !b1 || !b2 ) { 40 | switch ( _settings->ragebot_stuff2[ 0 ] ) { 41 | case 0: 42 | { 43 | this->aim_position = bone_index::head; 44 | } break; 45 | case 1: 46 | { 47 | this->aim_position = bone_index::pelvis; 48 | } break; 49 | } 50 | } 51 | 52 | if ( b1 || b2 ) { 53 | this->aim_position = bone_index::pelvis; 54 | } 55 | 56 | } 57 | 58 | /* hitbox shit */ 59 | switch ( unknowncheats::_settings->rage_hitbox ) { 60 | case 0: 61 | { 62 | this->aim_position = bone_index::head; 63 | } break; 64 | case 1: 65 | { 66 | this->aim_position = bone_index::neck_0; 67 | } break; 68 | case 2: 69 | { 70 | this->aim_position = bone_index::spine_1; 71 | } break; 72 | case 3: 73 | { 74 | this->aim_position = bone_index::pelvis; 75 | } break; 76 | } 77 | 78 | distance_to_sight = entity.get_bone( ).bone_pos_list[ bone_index::head ].screen_pos.dist_to( { ( 1920 / 2 ), ( 1080 / 2 ) } ); 79 | if ( distance_to_sight < max_aim_distance ) { 80 | max_aim_distance = distance_to_sight; 81 | 82 | if ( !_settings->ignore_wall || entity.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << ( local_idx ) ) || local.player_pawn.spotted_by_mask & ( DWORD64( 1 ) << ( ent_idx ) ) ) { 83 | aim_pos = entity.get_bone( ).bone_pos_list[ this->aim_position ].pos; 84 | 85 | if ( this->aim_position == bone_index::head ) 86 | aim_pos.z -= 1.f; 87 | } 88 | } 89 | 90 | /* paste fix */ 91 | if ( aim_pos == vec3_t( 0, 0, 0 ) ) { 92 | return; 93 | } 94 | 95 | if ( framework::m_b_open ) { 96 | return; 97 | } 98 | 99 | if ( entity.player_pawn.health <= 0 ) { 100 | return; 101 | } 102 | 103 | /* fix */ 104 | opp_pos = aim_pos - local_pos; 105 | distance = sqrt( pow( opp_pos.x, 2 ) + pow( opp_pos.y, 2 ) ); 106 | lenght = sqrt( distance * distance + opp_pos.z * opp_pos.z ); 107 | 108 | yaw = atan2f( opp_pos.y, opp_pos.x ) * 57.295779513 - local.player_pawn.viewangle.y; 109 | pitch = -atan( opp_pos.z / distance ) * 57.295779513 - local.player_pawn.viewangle.x; 110 | norm = sqrt( pow( yaw, 2 ) + pow( pitch, 2 ) ); 111 | 112 | vec2_t screen_pos; 113 | _address->view.world_to_screen( vec3_t( aim_pos ), screen_pos ); 114 | 115 | if ( norm < _settings->rage_fov ) { 116 | if ( screen_pos.x != screen_center_x ) { 117 | target_x = ( screen_pos.x > screen_center_x ) ? -( screen_center_x - screen_pos.x ) : screen_pos.x - screen_center_x; 118 | // target_x /= 0.5f; 119 | target_x = ( target_x + screen_center_x > screen_center_x * 2 || target_x + screen_center_x < 0 ) ? 0 : target_x; 120 | } 121 | 122 | if ( screen_pos.y != 0 ) { 123 | if ( screen_pos.y != screen_center_y ) { 124 | target_y = ( screen_pos.y > screen_center_y ) ? -( screen_center_y - screen_pos.y ) : screen_pos.y - screen_center_y; 125 | // target_y /= 0.5f; 126 | target_y = ( target_y + screen_center_y > screen_center_y * 2 || target_y + screen_center_y < 0 ) ? 0 : target_y; 127 | } 128 | } 129 | 130 | /* should be much better now */ 131 | if ( ( target_x < 2 && target_y < 2 ) && _esp->l_spotted( entity, local, local_idx, ent_idx ) ) { 132 | mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 ); 133 | std::thread trigger_thread( release_mouse_event_rage ); 134 | trigger_thread.detach( ); 135 | } 136 | 137 | 138 | float distance_ratio = norm / _settings->rage_fov; 139 | float speed_factor = 1.0f + ( 1.0f - distance_ratio ); 140 | target_x /= speed_factor; 141 | target_y /= speed_factor; 142 | 143 | if ( screen_pos.x != screen_center_x ) { 144 | target_x = ( screen_pos.x > screen_center_x ) ? -( screen_center_x - screen_pos.x ) : screen_pos.x - screen_center_x; 145 | // target_x /= 0.5f; 146 | target_x = ( target_x + screen_center_x > screen_center_x * 2 || target_x + screen_center_x < 0 ) ? 0 : target_x; 147 | } 148 | 149 | if ( screen_pos.y != 0 ) { 150 | if ( screen_pos.y != screen_center_y ) { 151 | target_y = ( screen_pos.y > screen_center_y ) ? -( screen_center_y - screen_pos.y ) : screen_pos.y - screen_center_y; 152 | // target_y /= 0.5f; 153 | target_y = ( target_y + screen_center_y > screen_center_y * 2 || target_y + screen_center_y < 0 ) ? 0 : target_y; 154 | } 155 | } 156 | mouse_event( MOUSEEVENTF_MOVE, target_x, target_y, NULL, NULL ); 157 | 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /fhook/hacks/features/ragebot/ragebot.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class rage_t { 5 | public: 6 | void run_aimbot( const c_entity& entity, const c_entity& local, vec3_t local_pos, int ent_idx, int local_idx ); 7 | 8 | DWORD aim_position = bone_index::head; 9 | }; 10 | 11 | inline const auto _rage = std::make_unique< rage_t >( ); 12 | } -------------------------------------------------------------------------------- /fhook/hacks/features/shots/shots.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | #include "shots_hitsound.hpp" 3 | #pragma comment(lib, "Winmm.lib") 4 | #include "../../../sdk/animation_system/animation_system.hpp" 5 | 6 | void unknowncheats::shots_t::hitsound( const c_entity& entity ) { 7 | 8 | 9 | static int prev_total_hits; 10 | int total_hits; 11 | uintptr_t bullet_services; 12 | 13 | _proc_manager.read_memory( entity.player_pawn.address + 0x16B8, bullet_services ); 14 | _proc_manager.read_memory( bullet_services + 0x40, total_hits ); 15 | 16 | if ( total_hits != prev_total_hits ) { 17 | if ( total_hits == 0 && prev_total_hits != 0 ) { } else { 18 | /*xref 19 | vector < const char* > hitsound = { 20 | "Neverlose", 21 | "Skeet", 22 | "Primordial", 23 | "Sound 1", 24 | "Sound 2", 25 | "Toy duck", 26 | "Bell 1", 27 | "Bell 2", 28 | "Button", 29 | "Pop", 30 | "Wow" 31 | }; 32 | */ 33 | if ( _settings->hitsound ) { 34 | switch ( _settings->hitsound_type ) { 35 | case 0: 36 | { 37 | PlaySoundA( reinterpret_cast< char* > ( neverlose_sound ), NULL, SND_ASYNC | SND_MEMORY ); 38 | } break; 39 | case 1: 40 | { 41 | PlaySoundA( reinterpret_cast< char* > ( skeet_sound ), NULL, SND_ASYNC | SND_MEMORY ); 42 | } break; 43 | case 2: 44 | { 45 | PlaySoundA( reinterpret_cast< char* > ( primordial_sound ), NULL, SND_ASYNC | SND_MEMORY ); 46 | } break; 47 | case 3: 48 | { 49 | PlaySoundA( reinterpret_cast< char* > ( cock_sound ), NULL, SND_ASYNC | SND_MEMORY ); 50 | } break; 51 | case 4: 52 | { 53 | PlaySoundA( reinterpret_cast< char* > ( bepis_sound ), NULL, SND_ASYNC | SND_MEMORY ); 54 | } break; 55 | case 5: 56 | { 57 | PlaySoundA( reinterpret_cast< char* > ( ratamac ), NULL, SND_ASYNC | SND_MEMORY ); 58 | } break; 59 | case 6: 60 | { 61 | PlaySoundA( reinterpret_cast< char* > ( bell1 ), NULL, SND_ASYNC | SND_MEMORY ); 62 | } break; 63 | case 7: 64 | { 65 | PlaySoundA( reinterpret_cast< char* > ( bell2 ), NULL, SND_ASYNC | SND_MEMORY ); 66 | } break; 67 | case 8: 68 | { 69 | PlaySoundA( reinterpret_cast< char* > ( button_snd ), NULL, SND_ASYNC | SND_MEMORY ); 70 | } break; 71 | case 9: 72 | { 73 | PlaySoundA( reinterpret_cast< char* > ( popsnd ), NULL, SND_ASYNC | SND_MEMORY ); 74 | } break; 75 | case 10: 76 | { 77 | PlaySoundA( reinterpret_cast< char* > ( wowsnd ), NULL, SND_ASYNC | SND_MEMORY ); 78 | } break; 79 | } 80 | } 81 | 82 | if ( _settings->hitmarker ) { 83 | hitmarker_info info; 84 | info.impacted = true; 85 | info.headshot = false; 86 | this->hitmarkers.push_back( info ); 87 | } 88 | } 89 | } 90 | prev_total_hits = total_hits; 91 | } 92 | 93 | void unknowncheats::shots_t::hitmarker( const c_entity& entity, const c_entity& local ) { 94 | if ( !_settings->hitmarker ) { 95 | if ( !this->hitmarkers.empty( ) ) { /* clear these mothercukers */ 96 | this->hitmarkers.clear( ); 97 | } 98 | 99 | /* do not run multiple times */ 100 | return; 101 | } 102 | 103 | if ( local.player_pawn.health <= 0 ) { /* clear these mothercukers */ 104 | if ( !this->hitmarkers.empty( ) ) { 105 | this->hitmarkers.clear( ); 106 | } 107 | 108 | /* do not run multiple times */ 109 | return; 110 | } 111 | 112 | auto center = ImGui::GetIO( ).DisplaySize * 0.5; 113 | 114 | for ( int i = 0; i < this->hitmarkers.size( ); i++ ) { 115 | auto animation = animation_controller.get( "hitmurker" + std::to_string( i ) + animation_controller.current_child ); 116 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( _settings->sound_animation_speed_l ) * ( this->hitmarkers[i].impacted ? 1.f : -1.f ) ); 117 | 118 | // unknowncheats::_render->add_line( ); 119 | unknowncheats::col_t col = this->hitmarkers[ i ].headshot ? unknowncheats::col_t( 255, 0, 0 ) : _render->to_main_color( _settings->hitmarker_col ); 120 | 121 | unknowncheats::_render->add_line( unknowncheats::vec2_t( center.x - 8, center.y - 8 ), unknowncheats::vec2_t( center.x - 4, center.y - 4 ), col.modify_alpha( 255 * animation.value ), 1 ); 122 | unknowncheats::_render->add_line( unknowncheats::vec2_t( center.x - 8, center.y + 8 ), unknowncheats::vec2_t( center.x - 4, center.y + 4 ), col.modify_alpha( 255 * animation.value ), 1 ); 123 | unknowncheats::_render->add_line( unknowncheats::vec2_t( center.x + 8, center.y - 8 ), unknowncheats::vec2_t( center.x + 4, center.y - 4 ), col.modify_alpha( 255 * animation.value ), 1 ); 124 | unknowncheats::_render->add_line( unknowncheats::vec2_t( center.x + 8, center.y + 8 ), unknowncheats::vec2_t( center.x + 4, center.y + 4 ), col.modify_alpha( 255 * animation.value ), 1 ); 125 | 126 | if ( animation.value >= 0.99 ) { 127 | this->hitmarkers[ i ].impacted = false; 128 | } 129 | 130 | if ( animation.value <= 0.0f && !this->hitmarkers[ i ].impacted ) { 131 | this->hitmarkers.erase( this->hitmarkers.begin( ) + i ); 132 | } 133 | } 134 | #if 0 135 | print_with_data_scoped( std::to_string( this->hitmarkers.size( ) ) ) 136 | #endif 137 | } 138 | -------------------------------------------------------------------------------- /fhook/hacks/features/shots/shots.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | // typedef struct _impact_info { /* thanks soufiw */ 5 | // float x, y, z; 6 | // float time; 7 | // }impact_info, * p_impact_info; 8 | // 9 | // typedef struct _hitmarker_info { /* thanks soufiw */ 10 | // impact_info pImpact; 11 | // float alpha; 12 | // int alpha2; 13 | // int damage; 14 | // float moved; 15 | // }hitmarker_info, * p_hitmarker_info; 16 | 17 | struct hitmarker_info { 18 | bool impacted; 19 | bool headshot; 20 | }; 21 | 22 | class shots_t { 23 | public: 24 | void hitsound( const c_entity& entity ); 25 | void hitmarker( const c_entity& entity, const c_entity& local ); 26 | 27 | //std::vector impacts; 28 | std::vector hitmarkers; 29 | }; 30 | 31 | inline const auto _shots = std::make_unique< shots_t >( ); 32 | } -------------------------------------------------------------------------------- /fhook/hacks/features/sound_system/sound.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | #include "../../../sdk/animation_system/animation_system.hpp" 3 | 4 | /* rendering stuff gonna sit there */ 5 | void render_filled_3d_circle( const unknowncheats::vec3_t& origin, float radius, unknowncheats::col_t color ) { 6 | static constexpr float pi = 3.14159265358979323846f; 7 | 8 | static constexpr float Step = pi * 2.0f / 60; 9 | std::vector points; 10 | for ( float lat = 0.f; lat <= pi * 2.0f; lat += Step ) { 11 | const auto& point3d = unknowncheats::vec3_t( sin( lat ), cos( lat ), 0.f ) * radius; 12 | unknowncheats::vec2_t point2d; 13 | if ( unknowncheats::_address->view.world_to_screen( origin + point3d, point2d ) ) 14 | points.push_back( ImVec2( point2d.x, point2d.y ) ); 15 | } 16 | ImGui::GetBackgroundDrawList( )->AddConvexPolyFilled( points.data( ), points.size( ), color.convert( ) ); 17 | } 18 | 19 | /* rendering stuff gonna sit there */ 20 | void render_3d_circle( const unknowncheats::vec3_t& origin, float radius, unknowncheats::col_t color ) { 21 | static constexpr float pi = 3.14159265358979323846f; 22 | static constexpr float Step = pi * 2.0f / 60; 23 | 24 | std::vector points; 25 | for ( float lat = 0.f; lat <= pi * 2.0f; lat += Step ) { 26 | const auto& point3d = unknowncheats::vec3_t( sin( lat ), cos( lat ), 0.f ) * radius; 27 | unknowncheats::vec2_t point2d; 28 | if ( unknowncheats::_address->view.world_to_screen( origin + point3d, point2d ) ) 29 | points.push_back( ImVec2( point2d.x, point2d.y ) ); 30 | } 31 | 32 | if ( !points.empty( ) ) { 33 | points.push_back( points.front( ) ); 34 | ImGui::GetBackgroundDrawList( )->AddPolyline( points.data( ), points.size( ), color.convert( ), false, 1.0f ); 35 | } 36 | } 37 | 38 | void unknowncheats::sound_info::push_sound( const c_entity& entity ) { 39 | if ( !_settings->local_sound ) 40 | return; /* do not run */ 41 | 42 | // game::m_flEmitSoundTime 43 | float smth3; // will we need to iterate? 44 | _proc_manager.read_memory( entity.player_pawn.address + offsets::pawn::emit_sound_time, smth3 ); 45 | 46 | static float main = smth3; 47 | 48 | if ( main != smth3 ) { 49 | #if 0 50 | printf( "mem[0]\n" ); 51 | #endif 52 | /* should pushback */ 53 | this->s_info_l.push_back( sound_info_t{ entity.player_pawn.vec_origin, true } ); 54 | 55 | /* reupdate */ 56 | main = smth3; 57 | } 58 | 59 | /* draw */ 60 | for ( int i = 0; i < this->s_info_l.size( ); i++ ) { 61 | auto animation = animation_controller.get( "soundinfo" + std::to_string( i ) + animation_controller.current_child ); 62 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( _settings->sound_animation_speed_l ) * ( this->s_info_l[i].has_changed ? 1.f : -1.f ) ); 63 | 64 | if ( animation.value >= 0.99f ) 65 | this->s_info_l[ i ].has_changed = false; 66 | 67 | render_3d_circle( this->s_info_l[ i ].player_origin, _settings->local_range * animation.value, _render->to_main_color( _settings->sound_col_l ) ); 68 | 69 | if ( i >= 60 ) { 70 | #if 0 71 | printf( "mem[1]" ); 72 | #endif 73 | this->s_info_l.erase( this->s_info_l.begin( ), this->s_info_l.begin( ) + 51 ); 74 | 75 | #if 0 76 | print_with_data_scoped( "size: " + std::to_string( this->s_info_l.size( ) ) ) 77 | #endif 78 | } 79 | } 80 | } 81 | 82 | void unknowncheats::sound_info::push_sound2( const c_entity& entity, int idx ) { /* use that for enemy */ 83 | if ( !_settings->enemy_sound ) 84 | return; 85 | 86 | // game::m_flEmitSoundTime 87 | float smth3; // will we need to iterate? 88 | _proc_manager.read_memory( entity.player_pawn.address + offsets::pawn::emit_sound_time, smth3 ); 89 | 90 | static float main[ 64 ]{smth3}; 91 | 92 | if ( main[idx] != smth3) { 93 | #if 0 94 | printf( "mem[0]\n" ); 95 | #endif 96 | /* should pushback */ 97 | this->s_info.push_back( sound_info_t{ entity.player_pawn.vec_origin, true } ); 98 | 99 | /* reupdate */ 100 | main[idx] = smth3; 101 | } 102 | 103 | /* draw */ 104 | for ( int i = 0; i < this->s_info.size( ); i++ ) { 105 | auto animation = animation_controller.get( "soundinfo" + std::to_string( i ) + animation_controller.current_child ); 106 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( _settings->sound_animation_speed_e ) * ( this->s_info[ i ].has_changed ? 1.f : -1.f ) ); 107 | 108 | if ( animation.value >= 0.99f ) 109 | this->s_info[ i ].has_changed = false; 110 | 111 | render_3d_circle( this->s_info[ i ].player_origin, _settings->enemy_range * animation.value, _render->to_main_color( _settings->sound_col_e ) ); 112 | 113 | if ( i >= 60 ) { 114 | #if 0 115 | printf( "mem[1]" ); 116 | #endif 117 | this->s_info.erase( this->s_info.begin( ), this->s_info.begin( ) + 51 ); 118 | 119 | #if 0 120 | print_with_data_scoped( "size: " + std::to_string( this->s_info.size( ) ) ) 121 | #endif 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /fhook/hacks/features/sound_system/sound.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | struct sound_info_t { 5 | vec3_t player_origin; 6 | bool has_changed; 7 | }; 8 | 9 | class sound_info { 10 | public: 11 | void push_sound( const c_entity& entity ); 12 | void push_sound2( const c_entity& entity, int idx ); 13 | 14 | std::vector s_info; 15 | std::vector s_info_l; 16 | }; 17 | 18 | inline const auto _sound = std::make_unique< sound_info >( ); 19 | } -------------------------------------------------------------------------------- /fhook/hacks/features/triggerbot/triggerbot.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../inc.hpp" 2 | 3 | /* handlers and stuff */ 4 | DWORD ent_handler = 0; 5 | DWORD64 list_avaible_entries = 0; 6 | DWORD64 entry_pawn_address = 0; 7 | unknowncheats::c_entity entity; 8 | bool allow_shot = false; 9 | /* handlers and stuff */ 10 | 11 | void release_mouse_event( ) { 12 | /* we can now shot so lets do it */ 13 | std::this_thread::sleep_for( std::chrono::milliseconds( unknowncheats::_settings->shot_delay ) ); /* add a custom delay and more */ 14 | mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 ); /* release shot event */ 15 | } 16 | 17 | void unknowncheats::trigger_t::run_trigger( const unknowncheats::c_entity& local_entity ) { 18 | /* read memory of ent index */ 19 | if ( !_proc_manager.read_memory( local_entity.player_pawn.address + offsets::pawn::ent_index, ent_handler ) ) { 20 | #ifdef read_data_dbg 21 | print_with_data_scoped( "trigger_t::run_trigger -> error -> no memory [ 0 ]" ); 22 | #endif // read_data_dbg 23 | return; 24 | } 25 | 26 | if ( ent_handler == -1 ) { 27 | #ifdef read_data_dbg_no 28 | print_with_data_scoped( "trigger_t::run_trigger -> error -> idx -1 ( invalid ) [ 1 ]" ); 29 | #endif // read_data_dbg 30 | return; 31 | } 32 | 33 | /* store this shit here */ 34 | list_avaible_entries = _proc_manager.trace_address( _address->get_entity_list_address( ), { 0x8 * ( ent_handler >> 9 ) + 0x10,0x0 } ); 35 | if ( list_avaible_entries == 0 ) { 36 | #ifdef read_data_dbg 37 | print_with_data_scoped( "trigger_t::run_trigger -> error -> idx 0 ( invalid ) [ 2 ]" ); 38 | #endif // read_data_dbg 39 | return; 40 | } 41 | 42 | if ( !_proc_manager.read_memory( list_avaible_entries + 0x78 * ( ent_handler & 0x1FF ), entry_pawn_address ) ) { 43 | #ifdef read_data_dbg 44 | print_with_data_scoped( "trigger_t::run_trigger -> error -> no memory [ 3 ]" ); 45 | #endif // read_data_dbg 46 | return; 47 | } 48 | 49 | /* update pawn */ 50 | if ( !entity.update_pawn( entry_pawn_address ) ) { 51 | #ifdef read_data_dbg_no 52 | print_with_data_scoped( "trigger_t::run_trigger -> error -> pawn::handler_t [ 4 ]" ); 53 | #endif // read_data_dbg 54 | return; 55 | } 56 | 57 | /* add team check here */ 58 | allow_shot = entity.player_pawn.health > 0; 59 | 60 | if ( !allow_shot ) { 61 | /* we re not gonna log this */ 62 | return; 63 | } 64 | 65 | 66 | static std::chrono::time_point last_point = std::chrono::steady_clock::now( ); 67 | auto cur_point = std::chrono::steady_clock::now( ); 68 | if ( cur_point - last_point >= std::chrono::milliseconds( _settings->reaction_time ) ) { 69 | const bool shooting = GetAsyncKeyState( VK_LBUTTON ) < 0; 70 | 71 | /* run if !shoting */ 72 | if ( !shooting ) { 73 | mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 ); 74 | std::thread trigger_thread( release_mouse_event ); 75 | trigger_thread.detach( ); 76 | } 77 | 78 | /* egalize these */ 79 | last_point = cur_point; 80 | } 81 | } 82 | 83 | void unknowncheats::trigger_t::run_thread_check( const c_entity& local_entity ) noexcept { 84 | /* here we run thread check and stuff */ 85 | } 86 | -------------------------------------------------------------------------------- /fhook/hacks/features/triggerbot/triggerbot.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class trigger_t { 5 | public: 6 | void run_trigger( const c_entity& local_entity ); 7 | void run_thread_check( const c_entity& local_entity ) noexcept; 8 | }; 9 | 10 | inline const auto _triggerbot = std::make_unique< trigger_t >( ); 11 | } -------------------------------------------------------------------------------- /fhook/inc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning ( disable : 4005 ) 3 | #pragma warning ( disable : 26495 ) 4 | #pragma warning ( disable : 4244 ) 5 | #pragma warning ( disable : 4267 ) 6 | #pragma warning ( disable : 4715 ) 7 | #pragma warning ( disable : 4018 ) 8 | #pragma warning ( disable : 4244 ) 9 | #pragma warning ( disable : 4305 ) 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* directx includes */ 33 | #include 34 | #include 35 | 36 | /* libs for directx */ 37 | #pragma comment(lib, "d3d11.lib") 38 | #pragma comment(lib, "D3D11.lib") 39 | #pragma comment(lib, "freetype.lib") 40 | #pragma comment(lib, "freetype_debug.lib") 41 | 42 | #include "thirdparty/imgui.h" 43 | #include "thirdparty/imgui_freetype.h" 44 | #include "thirdparty/imgui_impl_win32.h" 45 | #include "thirdparty/imgui_impl_dx9.h" 46 | #include "thirdparty/imgui_impl_dx11.h" 47 | 48 | #define ext_draw_list ImGui::GetBackgroundDrawList( ) 49 | #define read_data_dbg 50 | #define print_with_data(s) std::cout << "[unknowncheats-debug] " + s << std::endl; 51 | #define print_with_data_scoped(s) std::cout << "[unknowncheats-debug] " + std::string(s) << std::endl; 52 | 53 | #define custompi 3.14159265358979323846264338327950288f 54 | #define rad_pi 57.295779513082f; 55 | 56 | #define rad2deg(x) ((float)(x) * (float)(180.f / custompi)) 57 | #define deg2rad(x) ((float)(x) * (float)(custompi / 180.f)) 58 | 59 | /* inc */ 60 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); 61 | 62 | #include "sdk/math/color_t.hpp" 63 | #include "sdk/math/rect_t.hpp" 64 | #include "sdk/math/str_t.hpp" 65 | #include "sdk/render/render_sdk.hpp" 66 | 67 | #include "sdk/process_manager/process_manager.hpp" 68 | #include "sdk/memory/mem.hpp" 69 | #include "sdk/offsets/offsets.hpp" 70 | #include "sdk/classes/view.hpp" 71 | #include "core/ctx/ctx.hpp" 72 | 73 | #include "sdk/classes/bone_system.hpp" 74 | 75 | #include "sdk/classes/entity.hpp" 76 | #include "sdk/render/render.hpp" 77 | #include "sdk/input_system/input_system.hpp" 78 | 79 | #include "framework/config/cfg.hpp" 80 | #include "hacks/features/esp/esp.hpp" 81 | #include "hacks/features/triggerbot/triggerbot.hpp" 82 | #include "hacks/features/legitbot/legitbot.hpp" 83 | #include "hacks/features/ragebot/ragebot.hpp" 84 | #include "hacks/features/sound_system/sound.hpp" 85 | #include "hacks/features/flash_builder/flash_builder.hpp" 86 | #include "hacks/features/shots/shots.hpp" 87 | #include "hacks/features/grenade/grenades.hpp" 88 | 89 | #include "hacks/ctx/hacks_ctx.hpp" 90 | #include "framework/framework.hpp" 91 | 92 | /* resources */ 93 | #define IDS_APP_TITLE 103 94 | #define IDR_MAINFRAME 128 95 | #define IDD_GUITEST_DIALOG 102 96 | #define IDD_ABOUTBOX 103 97 | #define IDM_ABOUT 104 98 | #define IDM_EXIT 105 99 | #define IDI_GUITEST 107 100 | #define IDI_SMALL 108 101 | #define IDC_GUITEST 109 102 | #define IDC_MYICON 2 103 | #ifndef IDC_STATIC 104 | #define IDC_STATIC -1 105 | #endif 106 | 107 | #define ALPHA ( ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Float | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_PickerHueBar | ImGuiColorEditFlags_NoBorder ) 108 | #define NO_ALPHA ( ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Float | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_PickerHueBar | ImGuiColorEditFlags_NoBorder ) -------------------------------------------------------------------------------- /fhook/sdk/animation_system/animation_system.cpp: -------------------------------------------------------------------------------- 1 | #include "animation_system.hpp" 2 | #include 3 | #include 4 | 5 | // - hashed id 6 | // - animation float 7 | std::map stack; 8 | 9 | void anim_context_t::adjust( float adjust_to, bool clamp ) { 10 | auto animation = stack.find( id ); 11 | if ( animation == stack.end( ) ) { 12 | stack.insert( { id, 0.f } ); 13 | animation = stack.find( id ); 14 | } 15 | 16 | if ( clamp ) { 17 | animation->second = std::clamp( adjust_to, 0.f, 1.f ); 18 | } else { 19 | animation->second = adjust_to; 20 | } 21 | } 22 | 23 | anim_context_t animation_controller_t::get( std::string str ) { 24 | 25 | unsigned int hash = std::hash( )( str + current_child ); 26 | 27 | auto animation = stack.find( hash ); 28 | 29 | if ( animation == stack.end( ) ) { 30 | stack.insert( { hash, 0.f } ); 31 | animation = stack.find( hash ); 32 | } 33 | 34 | return { animation->second, hash }; 35 | } 36 | 37 | float animation_controller_t::ease( e_ease_type type, float in ) { 38 | switch ( type ) { 39 | case in_circ: 40 | return 1 - sqrt( 1 - pow( in, 2 ) ); 41 | break; 42 | case out_circ: 43 | return sqrt( 1 - pow( in - 1, 2 ) ); 44 | break; 45 | case in_out_circ: 46 | return in < 0.5 ? ( 1 - sqrt( 1 - pow( 2 * in, 2 ) ) ) / 2 : ( sqrt( 1 - pow( -2 * in + 2, 2 ) ) + 1 ) / 2; 47 | break; 48 | case in_quad: 49 | return in * in; 50 | break; 51 | case out_quad: 52 | return 1 - ( 1 - in ) * ( 1 - in ); 53 | break; 54 | case in_out_quad: 55 | return in < 0.5 ? 2 * in * in : 1 - pow( -2 * in + 2, 2 ) / 2; 56 | break; 57 | default: 58 | return in; 59 | } 60 | 61 | return in; 62 | } 63 | 64 | void animation_controller_t::clear_stack( ) { 65 | stack.clear( ); 66 | } -------------------------------------------------------------------------------- /fhook/sdk/animation_system/animation_system.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #pragma warning ( disable : 4244 ) 4 | 5 | struct anim_context_t { 6 | float value; 7 | unsigned int id; 8 | 9 | void adjust( float adjust_to, bool clamp = true ); 10 | }; 11 | 12 | enum e_ease_type { 13 | in_circ = 0 << 0, 14 | out_circ = 1 << 0, 15 | in_out_circ = 2 << 0, 16 | in_quad = 3 << 0, 17 | out_quad = 4 << 0, 18 | in_out_quad = 5 << 0, 19 | }; 20 | 21 | struct animation_controller_t { 22 | 23 | std::string current_child; 24 | 25 | anim_context_t get( std::string str ); 26 | 27 | float ease( e_ease_type type, float in ); 28 | 29 | void clear_stack( ); 30 | 31 | __forceinline float lerp( float x, float goal, float time ) { 32 | return float( x + ( goal - x ) * time ); 33 | } 34 | 35 | __forceinline float lerp_single( float a, float b, float t ) { 36 | return ( 1 - t ) * a + t * b; 37 | } 38 | 39 | __forceinline float lerp_ease( float a, float b, float t, bool easeIn, bool easeOut ) { 40 | if ( easeIn && easeOut ) { 41 | // Ease-in-out 42 | float smoothT = t * t * ( 3.0f - 2.0f * t ); 43 | return a + smoothT * ( b - a ); 44 | } else if ( easeIn ) { 45 | // Ease-in 46 | float smoothT = t * t; 47 | return a + smoothT * ( b - a ); 48 | } else if ( easeOut ) { 49 | // Ease-out 50 | float smoothT = 1.0f - ( 1.0f - t ) * ( 1.0f - t ); 51 | return a + smoothT * ( b - a ); 52 | } else { 53 | // Linear (no easing) 54 | return ( 1 - t ) * a + t * b; 55 | } 56 | } 57 | 58 | 59 | __forceinline float get_min_deltatime( float scale = 1.f ) { 60 | return ( 1.f / 0.2f ) * 0.010 * scale; 61 | } 62 | 63 | }; inline animation_controller_t animation_controller; -------------------------------------------------------------------------------- /fhook/sdk/classes/bone_system.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | enum bone_index : DWORD { 5 | head = 6, 6 | neck_0 = 5, 7 | spine_1 = 4, 8 | spine_2 = 2, 9 | pelvis = 0, 10 | arm_upper_L = 8, 11 | arm_lower_L = 9, 12 | hand_L = 10, 13 | arm_upper_R = 13, 14 | arm_lower_R = 14, 15 | hand_R = 15, 16 | hand_R2 = 16, 17 | leg_upper_L = 22, 18 | leg_lower_L = 23, 19 | ankle_L = 24, 20 | leg_upper_R = 25, 21 | leg_lower_R = 26, 22 | ankle_R = 27, 23 | }; 24 | 25 | struct bone_data { /* oh shit */ 26 | vec3_t pos; 27 | char pad[ 0x14 ]; 28 | }; 29 | 30 | struct bone_pos { 31 | vec3_t pos; 32 | vec2_t screen_pos; 33 | bool is_visible = false; 34 | }; 35 | 36 | class bone_t { 37 | private: 38 | DWORD64 pawn_address = 0; 39 | public: 40 | std::vector bone_pos_list; 41 | 42 | __forceinline bool update_bone_data( const DWORD64& pawn_address ) { 43 | if ( pawn_address == 0 ) { 44 | #if 1 45 | /* debug */ 46 | printf( "[unknowncheats] player controller is 0\n" ); 47 | #endif 48 | return false; 49 | } 50 | 51 | this->pawn_address = pawn_address; 52 | 53 | /* stuff */ 54 | DWORD64 game_scene_node = 0; 55 | DWORD64 bone_array_address = 0; 56 | 57 | if ( !_proc_manager.read_memory( pawn_address + offsets::c_base_entity::game_scene_node, game_scene_node ) ) { 58 | #ifdef read_data_dbg 59 | print_with_data_scoped( "bone_t::pawn_address -> error -> no memory" ); 60 | #endif // read_data_dbg 61 | return false; 62 | } 63 | 64 | if ( !_proc_manager.read_memory( game_scene_node + offsets::c_base_entity::bone_array, bone_array_address ) ) { 65 | #ifdef read_data_dbg 66 | print_with_data_scoped( "bone_t::scene_node -> error -> no memory" ); 67 | #endif // read_data_dbg 68 | return false; 69 | } 70 | 71 | bone_data bone_array[ 30 ]{}; 72 | if ( !_proc_manager.read_memory( bone_array_address, bone_array, 30 * sizeof( bone_data ) ) ) { 73 | #ifdef read_data_dbg 74 | print_with_data_scoped( "bone_t::bone_array_address -> error -> no memory bone_array" ); 75 | #endif // read_data_dbg 76 | return false; 77 | } 78 | 79 | for ( int i = 0; i < 30; i++ ) { 80 | unknowncheats::vec2_t screen_pos; 81 | bool is_visible = false; 82 | 83 | if ( unknowncheats::_address->view.world_to_screen( bone_array[ i ].pos, screen_pos ) ) { 84 | is_visible = true; 85 | } 86 | 87 | this->bone_pos_list.push_back( { bone_array[ i ].pos, screen_pos, is_visible } ); 88 | } 89 | 90 | return this->bone_pos_list.size( ) > 0; 91 | } 92 | }; 93 | 94 | namespace bone_list { 95 | inline std::list trunk = { neck_0,spine_2, pelvis }; 96 | inline std::list left_arm = { neck_0, arm_upper_L, arm_lower_L, hand_L }; 97 | inline std::list right_arm = { neck_0, arm_upper_R,arm_lower_R, hand_R }; 98 | inline std::list left_leg = { pelvis, leg_upper_L , leg_lower_L, ankle_L }; 99 | inline std::list right_leg = { pelvis, leg_upper_R , leg_lower_R, ankle_R }; 100 | inline std::vector> hitbox_list = { trunk, left_arm, right_arm, left_leg, right_leg }; 101 | } 102 | } -------------------------------------------------------------------------------- /fhook/sdk/classes/view.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class view_t { 5 | public: 6 | float matrix[ 4 ][ 4 ]{}; 7 | 8 | bool world_to_screen( const vec3_t& Pos, vec2_t& ToPos ) { 9 | float View = 0.f; 10 | float SightX = ( ImGui::GetIO( ).DisplaySize.x / 2 ), SightY = ( ImGui::GetIO( ).DisplaySize.y / 2 ); 11 | 12 | View = matrix[ 3 ][ 0 ] * Pos.x + matrix[ 3 ][ 1 ] * Pos.y + matrix[ 3 ][ 2 ] * Pos.z + matrix[ 3 ][ 3 ]; 13 | 14 | if ( View <= 0.01 ) 15 | return false; 16 | 17 | ToPos.x = SightX + ( matrix[ 0 ][ 0 ] * Pos.x + matrix[ 0 ][ 1 ] * Pos.y + matrix[ 0 ][ 2 ] * Pos.z + matrix[ 0 ][ 3 ] ) / View * SightX; 18 | ToPos.y = SightY - ( matrix[ 1 ][ 0 ] * Pos.x + matrix[ 1 ][ 1 ] * Pos.y + matrix[ 1 ][ 2 ] * Pos.z + matrix[ 1 ][ 3 ] ) / View * SightY; 19 | 20 | return true; 21 | } 22 | 23 | vec2_t get_screen_center( ) { 24 | vec2_t Pos; 25 | Pos.x = ImGui::GetIO( ).DisplaySize.x / 2; 26 | Pos.y = ImGui::GetIO( ).DisplaySize.y / 2; 27 | return Pos; 28 | } 29 | }; 30 | } -------------------------------------------------------------------------------- /fhook/sdk/input_system/input_system.cpp: -------------------------------------------------------------------------------- 1 | #include "../../inc.hpp" 2 | 3 | int unknowncheats::input_t::get_bind_id( int setting ) { 4 | int vk; 5 | switch ( setting ) { 6 | case 0: break; 7 | case 1: vk = VK_LBUTTON; break; 8 | case 2: vk = VK_RBUTTON; break; 9 | case 3: vk = VK_MBUTTON; break; 10 | case 4: vk = VK_XBUTTON1; break; 11 | case 5: vk = VK_XBUTTON2; break; 12 | case 6: vk = 0x41; break; 13 | case 7: vk = 0x42; break; 14 | case 8: vk = 0x43; break; 15 | case 9: vk = 0x44; break; 16 | case 10: vk = 0x45; break; 17 | case 11: vk = 0x46; break; 18 | case 12: vk = 0x47; break; 19 | case 13: vk = 0x48; break; 20 | case 14: vk = 0x49; break; 21 | case 15: vk = 0x4A; break; 22 | case 16: vk = 0x4B; break; 23 | case 17: vk = 0x4C; break; 24 | case 18: vk = 0x4D; break; 25 | case 19: vk = 0x4E; break; 26 | case 20: vk = 0x4F; break; 27 | case 21: vk = 0x50; break; 28 | case 22: vk = 0x51; break; 29 | case 23: vk = 0x52; break; 30 | case 24: vk = 0x53; break; 31 | case 25: vk = 0x54; break; 32 | case 26: vk = 0x55; break; 33 | case 27: vk = 0x56; break; 34 | case 28: vk = 0x57; break; 35 | case 29: vk = 0x58; break; 36 | case 30: vk = 0x59; break; 37 | case 31: vk = 0x5A; break; 38 | case 32: vk = 0x31; break; 39 | case 33: vk = 0x32; break; 40 | case 34: vk = 0x33; break; 41 | case 35: vk = 0x34; break; 42 | case 36: vk = 0x35; break; 43 | case 37: vk = 0x36; break; 44 | case 38: vk = 0x37; break; 45 | case 39: vk = 0x38; break; 46 | case 40: vk = 0x39; break; 47 | case 41: vk = 0x30; break; 48 | case 42: vk = VK_F1; break; 49 | case 43: vk = VK_F2; break; 50 | case 44: vk = VK_F3; break; 51 | case 45: vk = VK_F4; break; 52 | case 46: vk = VK_F5; break; 53 | case 47: vk = VK_F6; break; 54 | case 48: vk = VK_F7; break; 55 | case 49: vk = VK_F8; break; 56 | case 50: vk = VK_F9; break; 57 | case 51: vk = VK_F10; break; 58 | case 52: vk = VK_F11; break; 59 | case 53: vk = VK_F12; break; 60 | case 54: vk = VK_MENU; break; 61 | default: break; 62 | } 63 | return vk; 64 | } 65 | -------------------------------------------------------------------------------- /fhook/sdk/input_system/input_system.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | class input_t { 5 | public: 6 | int get_bind_id( int setting ); 7 | }; 8 | 9 | inline const auto _input_key = std::make_unique< input_t >( ); 10 | } -------------------------------------------------------------------------------- /fhook/sdk/math/color_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct col_t { 4 | col_t( ) : r( 255 ), g( 255 ), b( 255 ), a( 255 ) { } /* default white */ 5 | col_t( int r, int g, int b, int a = 255 ) : r( r ), g( g ), b( b ), a( a ) { } 6 | ~col_t( ) { } 7 | 8 | typedef struct { 9 | double h; 10 | double s; 11 | double v; 12 | } hsv; 13 | 14 | typedef struct { 15 | double r; 16 | double g; 17 | double b; 18 | } rgb; 19 | 20 | col_t modify_alpha( int a ) { 21 | return col_t( r, g, b, a ); 22 | } 23 | 24 | static float base( const unsigned char col ) { 25 | return col / 255.f; 26 | } 27 | 28 | std::uint32_t convert( ) { 29 | std::uint32_t out = 0; 30 | 31 | out = static_cast< std::uint32_t >( this->r ) << 0; 32 | out |= static_cast< std::uint32_t >( this->g ) << 8; 33 | out |= static_cast< std::uint32_t >( this->b ) << 16; 34 | out |= static_cast< std::uint32_t >( this->a ) << 24; 35 | 36 | return out; 37 | } 38 | 39 | static float hue( const col_t color ) { 40 | float R = base( color.r ); 41 | float G = base( color.g ); 42 | float B = base( color.b ); 43 | float mx = max( R, max( G, B ) ); 44 | float mn = min( R, min( G, B ) ); 45 | 46 | if ( mx == mn ) 47 | return 0.f; 48 | 49 | float delta = mx - mn; 50 | float hue = 0.f; 51 | 52 | if ( mx == R ) 53 | hue = ( G - B ) / delta; 54 | 55 | else 56 | if ( mx == G ) 57 | hue = 2.f + ( B - R ) / delta; 58 | 59 | else 60 | hue = 4.f + ( R - G ) / delta; 61 | 62 | hue *= 60.f; 63 | 64 | if ( hue < 0.f ) 65 | hue += 360.f; 66 | 67 | return hue / 360.f; 68 | } 69 | 70 | static float saturation( const col_t color ) { 71 | float R = base( color.r ); 72 | float G = base( color.g ); 73 | float B = base( color.b ); 74 | float mx = max( R, max( G, B ) ); 75 | float mn = min( R, min( G, B ) ); 76 | float delta = mx - mn; 77 | 78 | if ( mx == 0.f ) 79 | return delta; 80 | 81 | return delta / mx; 82 | } 83 | 84 | static float brightness( const col_t color ) { 85 | float R = base( color.r ); 86 | float G = base( color.g ); 87 | float B = base( color.b ); 88 | return max( R, max( G, B ) ); 89 | } 90 | 91 | float hue( ) const { 92 | return hue( *this ); 93 | } 94 | 95 | float saturation( ) const { 96 | return saturation( *this ); 97 | } 98 | 99 | float brightness( ) const { 100 | return brightness( *this ); 101 | } 102 | 103 | static col_t from_hsb( float hue /* 0.f - 1.f*/, 104 | float saturation /* 0.f - 1.f */, 105 | float brightness /* 0.f - 1.f */, 106 | int alpha = 255 ) { 107 | hue = std::clamp( hue, 0.f, 1.f ); 108 | saturation = std::clamp( saturation, 0.f, 1.f ); 109 | brightness = std::clamp( brightness, 0.f, 1.f ); 110 | float h = ( hue == 1.f ) ? 0.f : ( hue * 6.f ); 111 | float f = h - static_cast< int >( h ); 112 | float p = brightness * ( 1.f - saturation ); 113 | float q = brightness * ( 1.f - saturation * f ); 114 | float t = brightness * ( 1.f - ( saturation * ( 1.f - f ) ) ); 115 | 116 | if ( h < 1.f ) 117 | return col_t( brightness * 255, t * 255, p * 255, alpha ); 118 | 119 | else 120 | if ( h < 2.f ) 121 | return col_t( q * 255, brightness * 255, p * 255, alpha ); 122 | 123 | else 124 | if ( h < 3.f ) 125 | return col_t( p * 255, brightness * 255, t * 255, alpha ); 126 | 127 | else 128 | if ( h < 4 ) 129 | return col_t( p * 255, q * 255, brightness * 255, alpha ); 130 | 131 | else 132 | if ( h < 5 ) 133 | return col_t( t * 255, p * 255, brightness * 255, alpha ); 134 | 135 | else 136 | return col_t( brightness * 255, p * 255, q * 255, alpha ); 137 | } 138 | 139 | col_t blend( const col_t& other, float fraction ) const { 140 | int r_d = r - other.r; 141 | int g_d = g - other.g; 142 | int b_d = b - other.b; 143 | int a_d = a - other.a; 144 | 145 | int blended_r = r - ( r_d * fraction ); 146 | int blended_g = g - ( g_d * fraction ); 147 | int blended_b = b - ( b_d * fraction ); 148 | int blended_a = a - ( a_d * fraction ); 149 | 150 | return col_t{ blended_r, blended_g, blended_b, blended_a }; 151 | } 152 | 153 | col_t darker( int amount ) { 154 | int red = r; 155 | int green = g; 156 | int blue = b; 157 | 158 | // reduce the RGB values by the given amount 159 | red = std::fmax( 0, red - amount ); 160 | green = std::fmax( 0, green - amount ); 161 | blue = std::fmax( 0, blue - amount ); 162 | 163 | return col_t( red, green, blue, a ); 164 | } 165 | 166 | static hsv rgb_to_hsv( int r, int g, int b ) { 167 | rgb in = { ( float )( r / 255 ), ( float )( g / 255 ) , ( float )( b / 255 ) }; 168 | hsv out; 169 | double min, max, delta; 170 | 171 | min = in.r < in.g ? in.r : in.g; 172 | min = min < in.b ? min : in.b; 173 | 174 | max = in.r > in.g ? in.r : in.g; 175 | max = max > in.b ? max : in.b; 176 | 177 | out.v = max; 178 | delta = max - min; 179 | if ( delta < 0.00001 ) { 180 | out.s = 0; 181 | out.h = 0; 182 | return out; 183 | } 184 | if ( max > 0.0 ) { 185 | out.s = ( delta / max ); 186 | } else { 187 | out.s = 0.0; 188 | out.h = NAN; 189 | return out; 190 | } 191 | if ( in.r >= max ) 192 | out.h = ( in.g - in.b ) / delta; 193 | else 194 | if ( in.g >= max ) 195 | out.h = 2.0 + ( in.b - in.r ) / delta; 196 | else 197 | out.h = 4.0 + ( in.r - in.g ) / delta; 198 | 199 | out.h *= 60.0; 200 | 201 | if ( out.h < 0.0 ) 202 | out.h += 360.0; 203 | 204 | return out; 205 | } 206 | 207 | static col_t hsv_to_rgb( double h, double s, double v ) { 208 | double hh, p, q, t, ff; 209 | long i; 210 | rgb out; 211 | 212 | if ( s <= 0.0 ) { 213 | out.r = v; 214 | out.g = v; 215 | out.b = v; 216 | return col_t( out.r * 255.f, out.g * 255.f, out.b * 255.f ); 217 | } 218 | hh = h; 219 | if ( hh >= 360.0 ) hh = 0.0; 220 | hh /= 60.0; 221 | i = ( long )hh; 222 | ff = hh - i; 223 | p = v * ( 1.0 - s ); 224 | q = v * ( 1.0 - ( s * ff ) ); 225 | t = v * ( 1.0 - ( s * ( 1.0 - ff ) ) ); 226 | 227 | switch ( i ) { 228 | case 0: 229 | out.r = v; 230 | out.g = t; 231 | out.b = p; 232 | break; 233 | case 1: 234 | out.r = q; 235 | out.g = v; 236 | out.b = p; 237 | break; 238 | case 2: 239 | out.r = p; 240 | out.g = v; 241 | out.b = t; 242 | break; 243 | 244 | case 3: 245 | out.r = p; 246 | out.g = q; 247 | out.b = v; 248 | break; 249 | case 4: 250 | out.r = t; 251 | out.g = p; 252 | out.b = v; 253 | break; 254 | case 5: 255 | default: 256 | out.r = v; 257 | out.g = p; 258 | out.b = q; 259 | break; 260 | } 261 | return col_t( int( out.r * 255.f ), int( out.g * 255.f ), int( out.b * 255.f ) ); 262 | } 263 | 264 | int r, g, b, a; 265 | }; 266 | 267 | struct fcol_t { 268 | fcol_t( ) = default; 269 | fcol_t( float _r, float _g, float _b, float _a = 1.0f ) : 270 | r( _r ), g( _g ), b( _b ), a( _a ) { } 271 | 272 | fcol_t( int _r, int _g, int _b, int _a = 255 ) { 273 | set_color( _r, _g, _b, _a ); 274 | } 275 | 276 | __forceinline void set_color( float _r, float _g, float _b, float _a = 1.0f ) { 277 | r = _r; 278 | g = _g; 279 | b = _b; 280 | a = _a; 281 | } 282 | 283 | float r, g, b, a; 284 | }; -------------------------------------------------------------------------------- /fhook/sdk/math/rect_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class rect_t { 4 | public: 5 | float x, y, w, h; 6 | 7 | rect_t( ) : x( 0 ), y( 0 ), w( 0 ), h( 0 ) { } 8 | rect_t( float x, float y, float w, float h ) : x( x ), y( y ), w( w ), h( h ) { } 9 | ~rect_t( ) { } 10 | }; -------------------------------------------------------------------------------- /fhook/sdk/math/str_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | __forceinline std::string precision( const T a_value ) { 5 | std::stringstream out; 6 | out << std::fixed << std::setprecision( 2 ) << a_value; 7 | return out.str( ); 8 | } -------------------------------------------------------------------------------- /fhook/sdk/memory/mem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | namespace mem { 5 | template // get_data_with_offset 6 | inline bool scan_memory( std::string datatype, const DWORD64& address, DWORD offset, T& data ) { 7 | if ( address == 0 ) { 8 | #ifdef read_data_dbg 9 | print_with_data( datatype + " address is 0" ); 10 | #endif 11 | return false; 12 | } 13 | 14 | if ( !_proc_manager.read_memory( address + offset, data ) ) { 15 | #ifdef read_data_dbg 16 | print_with_data( datatype + " cant process memory data" ); 17 | #endif 18 | return false; 19 | } 20 | 21 | return true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /fhook/sdk/offsets/offsets.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | namespace offsets { 5 | namespace c_base_entity { 6 | inline DWORD health = 0x32C; 7 | inline DWORD team_id = 0x3BF; 8 | inline DWORD vec_velocity = 0x3D8; 9 | inline DWORD game_scene_node = 0x310; 10 | inline DWORD bone_array = 0x1E0; /* xref: CSkeletonInstance_::m_modelState + CGameSceneNode_::m_vecOrigin -> if this gets outdate */ 11 | } 12 | 13 | namespace c_base_player_controler { 14 | inline DWORD player_pawn = 0x7EC; 15 | inline DWORD pawn_alive = 0x7F4; 16 | inline DWORD player_name = 0x640; 17 | inline DWORD ping = 0x720; 18 | 19 | inline DWORD has_hemlet = 0x801; 20 | inline DWORD has_defuser = 0x800; 21 | } 22 | 23 | namespace pawn { 24 | inline DWORD health = 0x32C; 25 | inline DWORD vec_old_origin = 0x1224; 26 | inline DWORD dormant = 0xE7; 27 | inline DWORD viewangle = 0x1518; 28 | inline DWORD camera_pos = 0x1294; 29 | inline DWORD ping_services = 0x1268; 30 | inline DWORD camera_services = 0x10E0; 31 | inline DWORD processing_value = 0x1F4; 32 | 33 | inline DWORD max_alpha = 0x146C; 34 | inline DWORD flash_Duration = 0x1470; 35 | inline DWORD flashbang_time = 0x145C; 36 | inline DWORD emit_sound_time = 0x1404; 37 | inline DWORD killed_by_hs = 0x1668; 38 | 39 | inline DWORD ent_index = 0x1544; /* should work */ 40 | inline DWORD spotted = 0x1638 + 0xC; /* xref: m_entitySpottedState + m_bSpottedByMask */ 41 | } 42 | 43 | namespace post_processing { 44 | inline DWORD exposure_control = 0xD05; // bool 45 | inline DWORD min_exposure = 0xCEC; // f 46 | inline DWORD max_exposure = 0xCF0; // f 47 | } 48 | 49 | namespace item_services { 50 | inline DWORD item_services_pawn = 0x10B0; 51 | inline DWORD has_defuser = 0x40; 52 | inline DWORD has_hemlet = 0x41; 53 | inline DWORD has_heavy_armor = 0x42; 54 | } 55 | 56 | namespace ping_services { 57 | inline DWORD player_ping = 0x40; 58 | } 59 | 60 | namespace c_base_weapon { 61 | inline DWORD clipping_weapon = 0x12B0; 62 | inline DWORD wpn_data_ptr = 0x360; 63 | inline DWORD weapon_services = 0x10A8; 64 | inline DWORD active_weapon = 0x60; 65 | inline DWORD clip_1 = 0x1570; 66 | inline DWORD cycle_time = 0xC34; 67 | inline DWORD max_clip = 0x1FC; 68 | inline DWORD penetration = 0xD3C; 69 | inline DWORD weapon_type = 0x240; 70 | inline DWORD zs_name = 0xC18; 71 | inline DWORD inaccuracy = 0xC7C; 72 | } 73 | 74 | namespace c_base_smoke { 75 | inline DWORD effect_begin = 0x1108; 76 | inline DWORD effect_spawn = 0x1149; 77 | inline DWORD smoke_effect = 0x110C; 78 | inline DWORD smoke_color = 0x1114; 79 | } 80 | 81 | namespace controller { 82 | inline DWORD money_services = 0x700; 83 | inline DWORD tracking_services = 0x710; 84 | inline DWORD damage_services = 0x718; 85 | } 86 | 87 | namespace c_money_services { 88 | inline DWORD i_account = 0x40; 89 | } 90 | 91 | namespace damage_services { 92 | inline DWORD i_dmg = 0x58; 93 | } 94 | 95 | namespace match_making { 96 | inline DWORD m_i_competitive_ranking = 0x770; // int32_t 97 | inline DWORD m_i_competitive_wins = 0x774; // int32_t 98 | inline DWORD m_i_competitive_rank_type = 0x778; // int8_t 99 | inline DWORD m_i_competitive_ranking_predicted_win = 0x77C; // int32_t 100 | inline DWORD m_i_competitive_ranking_predicted_loss = 0x780; // int32_t 101 | inline DWORD m_i_competitive_ranking_predicted_tie = 0x784; // int32_t 102 | } 103 | 104 | namespace tracking_services { 105 | inline DWORD total_damage = 0x110; 106 | } 107 | 108 | namespace modulation { 109 | inline DWORD sky3d = 0x1168; 110 | } 111 | 112 | namespace glow { 113 | inline DWORD glow_propety = 0xB98; /* xref: player + glow_property */ 114 | 115 | /* glow property 116 | player + glow_property -> glow_address 117 | glow_address->glow_color/glowing 118 | */ 119 | inline DWORD glow_color = 0x8; /* xref: vector - clr[0-3] */ 120 | inline DWORD glow_type = 0x30; /* xref: vector - clr[0-3] */ 121 | inline DWORD glow_color_override = 0x40; /* xref: Color - clr[0-3] */ 122 | inline DWORD glowing = 0x51; /* xref: bool */ 123 | } 124 | 125 | namespace c_game_scene_mode { 126 | inline DWORD vec_origin = 0x80; 127 | } 128 | } 129 | 130 | namespace dragged_offsets { 131 | inline DWORD entity_list = 0x17C1950; 132 | inline DWORD matrix = 0x1820150; 133 | inline DWORD view_angle = 0x1880DC0; 134 | inline DWORD local_player_controller = 0x1810F48; 135 | inline DWORD local_player_pawn = 0x16C8F58; 136 | inline DWORD force_jump = 0x16C23A0; 137 | inline DWORD global_vars = 0x16BDCB8; 138 | inline DWORD inventory_services; 139 | inline DWORD planted_c4 = 0x1824A88; 140 | } 141 | 142 | namespace signatures { 143 | const std::string inventory_services = "E8 ?? ?? ?? ?? 8B 45 D0 48 8B 55 D8"; // outdate 144 | const std::string global_vars = "48 89 0D ?? ?? ?? ?? 48 89 41"; // old? 145 | const std::string entity_list = "48 8B 0D ?? ?? ?? ?? 48 89 7C 24 ?? 8B FA C1 EB"; 146 | const std::string local_player_controller = "48 8B 05 ?? ?? ?? ?? 48 85 C0 74 ?? 8B 88"; 147 | const std::string view_angles = "48 8B 0D ?? ?? ?? ?? E9 ?? ?? ?? ?? CC CC CC CC 40 55"; 148 | const std::string view_matrix = "48 8D 05 ?? ?? ?? ?? 48 8B D3 4C 8D 05"; 149 | const std::string local_player_pawn = "48 8D 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 83 EC ?? 8B 0D"; 150 | const std::string force_jump = "48 8B 05 ?? ?? ?? ?? 48 8D 1D ?? ?? ?? ?? 48 89 45"; 151 | const std::string planted_c4 = "48 8B 15 ?? ?? ?? ?? FF C0 48 8D 4C 24 40"; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /fhook/sdk/process_manager/process_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "process_manager.hpp" 2 | #include 3 | 4 | inline const DWORD BLOCKMAXSIZE = 409600; 5 | 6 | int GetSignatureArray( const std::string& Signature, std::vector& SignatureArray ) { 7 | std::string Sig = Signature; 8 | Sig.erase( std::remove( Sig.begin( ), Sig.end( ), ' ' ), Sig.end( ) ); 9 | 10 | std::size_t Size = Sig.size( ); 11 | 12 | if ( Size % 2 != 0 ) 13 | return 0; 14 | 15 | for ( int i = 0; i < Size; i += 2 ) { 16 | std::string ByteString = Sig.substr( i, 2 ); 17 | WORD Byte = ( ByteString == "??" ) ? 256 : std::stoi( ByteString, nullptr, 16 ); 18 | SignatureArray.push_back( Byte ); 19 | } 20 | return SignatureArray.size( ); 21 | } 22 | 23 | void GetNextArray( std::vector& NextArray, const std::vector& SignatureArray ) { 24 | std::size_t Size = SignatureArray.size( ); 25 | for ( int i = 0; i < Size; i++ ) 26 | NextArray[ SignatureArray[ i ] ] = i; 27 | } 28 | 29 | void SearchMemoryBlock( byte* MemoryBuffer, const std::vector& NextArray, const std::vector& SignatureArray, DWORD64 StartAddress, DWORD Size, std::vector& ResultArray ) { 30 | if ( !_proc_manager.read_memory( StartAddress, *MemoryBuffer, Size ) ) 31 | return; 32 | 33 | int SignatureLength = SignatureArray.size( ); 34 | 35 | for ( int i = 0, j, k; i < Size;) { 36 | j = i; k = 0; 37 | 38 | for ( ; k < SignatureLength && j < Size && ( SignatureArray[ k ] == MemoryBuffer[ j ] || SignatureArray[ k ] == 256 ); k++, j++ ); 39 | 40 | if ( k == SignatureLength ) 41 | ResultArray.push_back( StartAddress + i ); 42 | 43 | if ( ( i + SignatureLength ) >= Size ) 44 | return; 45 | 46 | int Num = NextArray[ MemoryBuffer[ i + SignatureLength ] ]; 47 | if ( Num == -1 ) 48 | i += ( SignatureLength - NextArray[ 256 ] ); 49 | else 50 | i += ( SignatureLength - Num ); 51 | } 52 | } 53 | 54 | std::vector ProcessManager::search_memory( const std::string& Signature, DWORD64 StartAddress, DWORD64 EndAddress, int SearchNum ) { 55 | std::vector ResultArray; 56 | std::vector SignatureArray; 57 | std::vector NextArray( 260, -1 ); 58 | 59 | byte* MemoryBuffer = new byte[ BLOCKMAXSIZE ]; 60 | 61 | if ( GetSignatureArray( Signature, SignatureArray ) <= 0 ) 62 | return ResultArray; 63 | 64 | GetNextArray( NextArray, SignatureArray ); 65 | 66 | MEMORY_BASIC_INFORMATION mbi; 67 | int Count; 68 | while ( VirtualQueryEx( hProcess, reinterpret_cast< LPCVOID >( StartAddress ), &mbi, sizeof( mbi ) ) != 0 ) { 69 | Count = 0; 70 | auto BlockSize = mbi.RegionSize; 71 | 72 | while ( BlockSize >= BLOCKMAXSIZE ) { 73 | if ( ResultArray.size( ) >= SearchNum ) 74 | goto END; 75 | 76 | SearchMemoryBlock( MemoryBuffer, NextArray, SignatureArray, StartAddress + ( BLOCKMAXSIZE * Count ), BLOCKMAXSIZE, ResultArray ); 77 | 78 | BlockSize -= BLOCKMAXSIZE; 79 | Count++; 80 | } 81 | 82 | SearchMemoryBlock( MemoryBuffer, NextArray, SignatureArray, StartAddress + ( BLOCKMAXSIZE * Count ), BlockSize, ResultArray ); 83 | 84 | StartAddress += mbi.RegionSize; 85 | 86 | if ( ResultArray.size( ) >= SearchNum || EndAddress != 0 && StartAddress > EndAddress ) 87 | break; 88 | } 89 | 90 | END: 91 | 92 | delete[ ] MemoryBuffer; 93 | return ResultArray; 94 | } -------------------------------------------------------------------------------- /fhook/sdk/process_manager/process_manager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #define _is_invalid(v) if(v==NULL) return false 8 | #define _is_invalid(v,n) if(v==NULL) return n 9 | 10 | enum StatusCode { 11 | SUCCEED, 12 | FAILE_PROCESSID, 13 | FAILE_HPROCESS, 14 | FAILE_MODULE, 15 | }; 16 | 17 | class ProcessManager { 18 | private: 19 | 20 | bool Attached = false; 21 | 22 | public: 23 | 24 | HANDLE hProcess = 0; 25 | DWORD ProcessID = 0; 26 | DWORD64 ModuleAddress = 0; 27 | 28 | public: 29 | ~ProcessManager( ) { 30 | } 31 | 32 | StatusCode attach( std::string ProcessName ) { 33 | ProcessID = this->get_process_id( ProcessName ); 34 | _is_invalid( ProcessID, FAILE_PROCESSID ); 35 | 36 | hProcess = OpenProcess( PROCESS_ALL_ACCESS | PROCESS_CREATE_THREAD, TRUE, ProcessID ); 37 | _is_invalid( hProcess, FAILE_HPROCESS ); 38 | 39 | ModuleAddress = reinterpret_cast< DWORD64 >( this->get_process_module_handle( ProcessName ) ); 40 | _is_invalid( ModuleAddress, FAILE_MODULE ); 41 | 42 | Attached = true; 43 | 44 | return SUCCEED; 45 | } 46 | 47 | void detach( ) { 48 | if ( hProcess ) 49 | CloseHandle( hProcess ); 50 | hProcess = 0; 51 | ProcessID = 0; 52 | ModuleAddress = 0; 53 | Attached = false; 54 | } 55 | 56 | bool is_active( ) { 57 | if ( !Attached ) 58 | return false; 59 | DWORD ExitCode{}; 60 | GetExitCodeProcess( hProcess, &ExitCode ); 61 | return ExitCode == STILL_ACTIVE; 62 | } 63 | 64 | template 65 | bool read_memory( DWORD64 Address, ReadType& Value, int Size ) { 66 | _is_invalid( hProcess, false ); 67 | _is_invalid( ProcessID, false ); 68 | 69 | if ( ReadProcessMemory( hProcess, reinterpret_cast< LPCVOID >( Address ), &Value, Size, 0 ) ) 70 | return true; 71 | return false; 72 | } 73 | 74 | template 75 | bool read_memory( DWORD64 Address, ReadType& Value ) { 76 | _is_invalid( hProcess, false ); 77 | _is_invalid( ProcessID, false ); 78 | 79 | if ( ReadProcessMemory( hProcess, reinterpret_cast< LPCVOID >( Address ), &Value, sizeof( ReadType ), 0 ) ) 80 | return true; 81 | return false; 82 | } 83 | 84 | template 85 | bool write_memory( DWORD64 Address, ReadType& Value, int Size ) { 86 | _is_invalid( hProcess, false ); 87 | _is_invalid( ProcessID, false ); 88 | 89 | if ( WriteProcessMemory( hProcess, reinterpret_cast< LPCVOID >( Address ), &Value, Size, 0 ) ) 90 | return true; 91 | return false; 92 | } 93 | 94 | template 95 | bool write_memory( DWORD64 Address, ReadType& Value ) { 96 | _is_invalid( hProcess, false ); 97 | _is_invalid( ProcessID, false ); 98 | 99 | if ( WriteProcessMemory( hProcess, reinterpret_cast< LPVOID >( Address ), &Value, sizeof( ReadType ), 0 ) ) 100 | return true; 101 | return false; 102 | } 103 | 104 | template 105 | bool write_memory_nuke( DWORD64 Address, ReadType& Value ) { 106 | _is_invalid( hProcess, false ); 107 | _is_invalid( ProcessID, false ); 108 | 109 | if ( WriteProcessMemory( hProcess, reinterpret_cast< LPVOID >( Address ), &Value, sizeof( ReadType ), 0 ) ) 110 | return true; 111 | //return false; 112 | 113 | return true; 114 | } 115 | 116 | std::vector search_memory( const std::string& Signature, DWORD64 StartAddress, DWORD64 EndAddress, int SearchNum = 1 ); 117 | 118 | DWORD64 trace_address( DWORD64 BaseAddress, std::vector Offsets ) { 119 | _is_invalid( hProcess, 0 ); 120 | _is_invalid( ProcessID, 0 ); 121 | DWORD64 Address = 0; 122 | 123 | if ( Offsets.size( ) == 0 ) 124 | return BaseAddress; 125 | 126 | if ( !read_memory( BaseAddress, Address ) ) 127 | return 0; 128 | 129 | for ( int i = 0; i < Offsets.size( ) - 1; i++ ) { 130 | if ( !read_memory( Address + Offsets[ i ], Address ) ) 131 | return 0; 132 | } 133 | return Address == 0 ? 0 : Address + Offsets[ Offsets.size( ) - 1 ]; 134 | } 135 | 136 | public: 137 | 138 | DWORD get_process_id( std::string ProcessName ) { 139 | PROCESSENTRY32 ProcessInfoPE; 140 | ProcessInfoPE.dwSize = sizeof( PROCESSENTRY32 ); 141 | HANDLE hSnapshot = CreateToolhelp32Snapshot( 15, 0 ); 142 | Process32First( hSnapshot, &ProcessInfoPE ); 143 | USES_CONVERSION; 144 | do { 145 | if ( strcmp( W2A( ProcessInfoPE.szExeFile ), ProcessName.c_str( ) ) == 0 ) { 146 | CloseHandle( hSnapshot ); 147 | return ProcessInfoPE.th32ProcessID; 148 | } 149 | } while ( Process32Next( hSnapshot, &ProcessInfoPE ) ); 150 | CloseHandle( hSnapshot ); 151 | return 0; 152 | } 153 | 154 | HMODULE get_process_module_handle( std::string ModuleName ) { 155 | MODULEENTRY32 ModuleInfoPE; 156 | ModuleInfoPE.dwSize = sizeof( MODULEENTRY32 ); 157 | HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, this->ProcessID ); 158 | Module32First( hSnapshot, &ModuleInfoPE ); 159 | USES_CONVERSION; 160 | do { 161 | if ( strcmp( W2A( ModuleInfoPE.szModule ), ModuleName.c_str( ) ) == 0 ) { 162 | CloseHandle( hSnapshot ); 163 | return ModuleInfoPE.hModule; 164 | } 165 | } while ( Module32Next( hSnapshot, &ModuleInfoPE ) ); 166 | CloseHandle( hSnapshot ); 167 | return 0; 168 | } 169 | 170 | }; 171 | 172 | inline ProcessManager _proc_manager; -------------------------------------------------------------------------------- /fhook/sdk/render/render.cpp: -------------------------------------------------------------------------------- 1 | #include "../../inc.hpp" 2 | #include "../animation_system/animation_system.hpp" 3 | #include "render_fonts.hpp" 4 | 5 | void unknowncheats::render_t::initialize_font_system( ) { 6 | ImGuiIO& io = ImGui::GetIO( ); /* get imgui io */ 7 | 8 | /* create a new cfg for each type of font */ 9 | ImFontConfig cfg;// = new ImFontConfig( ); 10 | 11 | cfg.PixelSnapH = true; 12 | cfg.OversampleH = cfg.OversampleV = 1; 13 | 14 | /* ranges */ 15 | static const ImWchar ranges[ ] = 16 | { 17 | 0x0020, 0x00FF, 18 | 0x0400, 0x052F, 19 | 0x2DE0, 0x2DFF, 20 | 0xA640, 0xA69F, 21 | 0x3131, 0x3163, 22 | 0xAC00, 0xD79D, 23 | 0, 24 | }; 25 | 26 | auto add_font = [ & ]( const char* font, float size )->void { 27 | io.Fonts->AddFontFromFileTTF( font, size, &cfg, ranges ); 28 | 29 | printf( "Loaded font: %s, Size: %.1f\n", font, size ); 30 | }; 31 | 32 | 33 | add_font( "C:\\Windows\\Fonts\\verdana.ttf", 12.0f ); 34 | io.Fonts->AddFontFromMemoryTTF( _smallest_pixel, sizeof( _smallest_pixel ), 10.f ); 35 | 36 | 37 | /* freetype build */ 38 | ImGuiFreeType::BuildFontAtlas( io.Fonts, ImGuiFreeTypeBuilderFlags_Monochrome | ImGuiFreeTypeBuilderFlags_MonoHinting ); 39 | } 40 | 41 | void unknowncheats::render_t::add_line( unknowncheats::vec2_t from, unknowncheats::vec2_t to, col_t c, float thickness ) { 42 | ImGui::GetBackgroundDrawList( )->AddLine( ImVec2( from.x, from.y ), ImVec2( to.x, to.y ), c.convert( ), thickness ); 43 | } 44 | 45 | void unknowncheats::render_t::add_text( int x, int y, col_t c, int font, const char* text, int flag ) { 46 | ImGuiIO& io = ImGui::GetIO( ); 47 | ImGui::PushFont( io.Fonts->Fonts[ font ] ); 48 | 49 | if ( flag == font_flags_t::dropshadow ) { 50 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x + 1.f, y + 1.f ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 51 | } 52 | 53 | if ( flag == font_flags_t::outline ) { 54 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x + 1, y - 1 ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 55 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x - 1, y + 1 ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 56 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x - 1, y - 1 ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 57 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x + 1, y + 1 ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 58 | 59 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x, y + 1 ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 60 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x, y - 1 ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 61 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x + 1, y ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 62 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x - 1, y ), col_t( 5, 5, 5 ).modify_alpha( c.a ).convert( ), text ); 63 | } 64 | 65 | /* text */ 66 | ext_draw_list->AddText( unknowncheats::macros::vec_t( x, y ), c.convert( ), text ); 67 | 68 | ImGui::PopFont( ); 69 | } 70 | 71 | unknowncheats::vec2_t unknowncheats::render_t::text_size( const char* text, int font ) { 72 | ImGuiIO& io = ImGui::GetIO( ); 73 | 74 | return { 75 | io.Fonts->Fonts[ font ]->CalcTextSizeA( io.Fonts->Fonts[ font ]->FontSize, FLT_MAX, -1.0f, text ).x, 76 | io.Fonts->Fonts[ font ]->CalcTextSizeA( io.Fonts->Fonts[ font ]->FontSize, FLT_MAX, -1.0f, text ).y 77 | }; 78 | } 79 | 80 | void unknowncheats::render_t::add_rect_filled( int x, int y, int w, int h, unknowncheats::col_t col, int round ) { 81 | ext_draw_list->AddRectFilled( unknowncheats::macros::vec_t( x, y ), unknowncheats::macros::vec_t( x + w, y + h ), col.convert( ), round ); 82 | } 83 | 84 | void unknowncheats::render_t::add_rect( int x, int y, int w, int h, unknowncheats::col_t col, int round, int tickness ) { 85 | ext_draw_list->AddRect( unknowncheats::macros::vec_t( x, y ), unknowncheats::macros::vec_t( x + w, y + h ), col.convert( ), round, 0, tickness ); 86 | } 87 | 88 | unknowncheats::col_t unknowncheats::render_t::to_main_color( float color[ 4 ] ) { 89 | return unknowncheats::col_t( color[ 0 ] * 255.f, color[ 1 ] * 255.f, color[ 2 ] * 255.f, color[ 3 ] * 255.f ); 90 | } 91 | 92 | void unknowncheats::render_t::add_filled_circle( unknowncheats::vec2_t center, float radius, unknowncheats::col_t c ) { 93 | ext_draw_list->AddCircleFilled( unknowncheats::macros::vec_t( center.x, center.y ), radius, c.convert( ) ); 94 | } 95 | 96 | void unknowncheats::render_t::add_circle( unknowncheats::vec2_t center, float radius, unknowncheats::col_t c ) { 97 | ext_draw_list->AddCircle( unknowncheats::macros::vec_t( center.x, center.y ), radius, c.convert( ) ); 98 | } 99 | 100 | unknowncheats::macros::u32_t lerp_color( unknowncheats::macros::u32_t col1, unknowncheats::macros::u32_t col2, float t ) { 101 | unknowncheats::macros::vec4_t c1 = ImGui::ColorConvertU32ToFloat4( col1 ); 102 | unknowncheats::macros::vec4_t c2 = ImGui::ColorConvertU32ToFloat4( col2 ); 103 | unknowncheats::macros::vec4_t lerped = unknowncheats::macros::vec4_t( c1.x + t * ( c2.x - c1.x ), 104 | c1.y + t * ( c2.y - c1.y ), 105 | c1.z + t * ( c2.z - c1.z ), 106 | c1.w + t * ( c2.w - c1.w ) ); 107 | return ImGui::ColorConvertFloat4ToU32( lerped ); 108 | } 109 | 110 | void unknowncheats::render_t::add_gradient_circle_filled( unknowncheats::vec2_t c, int radius, unknowncheats::col_t inner_color, unknowncheats::col_t outer_color ) { 111 | for ( int i = 0; i <= radius; ++i ) { 112 | float t = static_cast< float >( i ) / radius; 113 | ImU32 color = ImGui::GetColorU32( lerp_color( inner_color.convert( ), outer_color.convert( ), t ) ); 114 | ext_draw_list->AddCircleFilled( unknowncheats::macros::vec_t( c.x, c.y ), static_cast< float >( i ), color ); 115 | } 116 | } 117 | 118 | void unknowncheats::render_t::add_gradient_vertical( int x, int y, int w, int h, unknowncheats::col_t c1, unknowncheats::col_t c2 ) { 119 | ext_draw_list->AddRectFilledMultiColor( unknowncheats::macros::vec_t( x, y ), unknowncheats::macros::vec_t( x + w, y + h ), c1.convert( ), c2.convert( ), c2.convert( ), c1.convert( ) ); 120 | } 121 | 122 | void unknowncheats::render_t::add_gradient_horizontal( int x, int y, int w, int h, unknowncheats::col_t c1, unknowncheats::col_t c2 ) { 123 | ext_draw_list->AddRectFilledMultiColor( unknowncheats::macros::vec_t( x, y ), unknowncheats::macros::vec_t( x + w, y + h ), c1.convert( ), c1.convert( ), c2.convert( ), c2.convert( ) ); 124 | } 125 | 126 | void unknowncheats::render_t::add_drop_shadow( int x, int y, int w, int h ) { 127 | this->add_gradient_horizontal( x, y - 5, w, 5, unknowncheats::col_t( 12, 26, 36, 0 ), unknowncheats::col_t( 12, 26, 36, 100 ) ); 128 | this->add_gradient_horizontal( x, y + h, w, 5, unknowncheats::col_t( 12, 26, 36, 100 ), unknowncheats::col_t( 12, 26, 36, 0 ) ); 129 | 130 | this->add_gradient_vertical( x - 5, y, 5, h, unknowncheats::col_t( 12, 26, 36, 0 ), unknowncheats::col_t( 12, 26, 36, 100 ) ); 131 | this->add_gradient_vertical( x + w, y, 5, h, unknowncheats::col_t( 12, 26, 36, 100 ), unknowncheats::col_t( 12, 26, 36, 0 ) ); 132 | } 133 | 134 | void unknowncheats::render_t::add_image( int x, int y, int w, int h, unknowncheats::macros::texture_id user_texture_id, unknowncheats::col_t c ) { 135 | ext_draw_list->AddImage( user_texture_id, unknowncheats::macros::vec_t( x, y ), unknowncheats::macros::vec_t( x + w, y + h ), ImVec2( 0, 0 ), ImVec2( 1, 1 ), c.convert( ) ); 136 | } 137 | 138 | void unknowncheats::render_t::bind_animation( int id, std::string text, unknowncheats::col_t color, int font, int x, int y, text_animation_t animation_type, float animation_speed ) { 139 | static int animation_[ 1000 ]; /* iterate */ 140 | 141 | int w_of_text = this->text_size( text.c_str( ), font ).x; 142 | int h_of_text = this->text_size( text.c_str( ), font ).y; 143 | 144 | switch ( animation_type ) { 145 | case text_animation_t::left_to_right: 146 | { 147 | auto animation = animation_controller.get( text + std::to_string( id ) + animation_controller.current_child ); 148 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( animation_speed ) * ( ( animation_[ id ] < w_of_text ) ? 1.f : -1.f ) ); 149 | 150 | if ( animation.value >= 0.99f ) { 151 | animation_[ id ] = w_of_text; 152 | } else if ( animation.value <= 0.f ) { 153 | animation_[ id ] = 0; 154 | } 155 | 156 | this->clip_rect( x, y, w_of_text * animation.value, h_of_text, [ & ]( ) { 157 | this->add_text( x, y, color, font, text.c_str( ) ); 158 | } ); 159 | } break; 160 | case text_animation_t::middle_pulse: 161 | { 162 | auto animation = animation_controller.get( text + std::to_string( id ) + animation_controller.current_child ); 163 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( animation_speed ) * ( ( animation_[ id ] < w_of_text ) ? 1.f : -1.f ) ); 164 | 165 | if ( animation.value >= 0.99f ) { 166 | animation_[ id ] = w_of_text; 167 | } else if ( animation.value <= 0.f ) { 168 | animation_[ id ] = 0; 169 | } 170 | 171 | this->clip_rect( x + ( w_of_text / 2 ) - ( ( ( w_of_text * 2 ) / 2 ) * ( animation.value / 2 ) ), y, 172 | ( ( w_of_text * 2 ) / 2 ) * animation.value, h_of_text, [ & ]( ) { 173 | this->add_text( x, y, color, font, text.c_str( ) ); 174 | } ); 175 | } break; 176 | case text_animation_t::tiny_color: 177 | { 178 | auto animation = animation_controller.get( text + std::to_string( id ) + animation_controller.current_child ); 179 | animation.adjust( animation.value + 3.f * animation_controller.get_min_deltatime( animation_speed ) * ( ( animation_[ id ] < w_of_text ) ? 1.f : -1.f ) ); 180 | 181 | if ( animation.value >= 0.99f ) { 182 | animation_[ id ] = w_of_text; 183 | } else if ( animation.value <= 0.f ) { 184 | animation_[ id ] = 0; 185 | } 186 | 187 | this->clip_rect( ( x - 15 ) + ( w_of_text * animation.value ), y, 45, h_of_text, [ & ]( ) { 188 | this->add_text( x, y, color, font, text.c_str( ) ); 189 | } ); 190 | } break; 191 | } 192 | } 193 | 194 | void unknowncheats::render_t::clip_rect( float x, float y, float w, float h, std::function< void( ) > function ) { 195 | ext_draw_list->PushClipRect( { x, y }, { x + w, y + h }, true ); 196 | 197 | function( ); 198 | 199 | ext_draw_list->PopClipRect( ); 200 | } -------------------------------------------------------------------------------- /fhook/sdk/render/render.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace unknowncheats { 4 | enum fonts_t { 5 | _default, 6 | _default_2 7 | }; 8 | 9 | enum font_flags_t { 10 | none, 11 | dropshadow, 12 | outline 13 | }; 14 | 15 | enum text_animation_t { 16 | left_to_right, 17 | middle_pulse, 18 | tiny_color 19 | }; 20 | 21 | class render_t { 22 | public: 23 | void initialize_font_system( ); 24 | 25 | void add_line( unknowncheats::vec2_t from, unknowncheats::vec2_t to, col_t c, float thickness ); 26 | 27 | void add_text( int x, int y, col_t c, int font, const char* text, int /* or font_flags_t */ flag = font_flags_t::none ); 28 | void add_rect_filled( int x, int y, int w, int h, unknowncheats::col_t col, int round ); 29 | void add_rect( int x, int y, int w, int h, unknowncheats::col_t col, int round, int tickness ); 30 | unknowncheats::col_t to_main_color( float color[ 4 ] ); 31 | void add_filled_circle( unknowncheats::vec2_t center, float radius, unknowncheats::col_t c ); 32 | void add_circle( unknowncheats::vec2_t center, float radius, unknowncheats::col_t c ); 33 | void add_gradient_circle_filled( unknowncheats::vec2_t c, int radius, unknowncheats::col_t inner_color, unknowncheats::col_t outer_color ); 34 | void add_gradient_vertical( int x, int y, int w, int h, unknowncheats::col_t c1, unknowncheats::col_t c2 ); 35 | void add_gradient_horizontal( int x, int y, int w, int h, unknowncheats::col_t c1, unknowncheats::col_t c2 ); 36 | void add_drop_shadow( int x, int y, int w, int h ); 37 | void add_image( int x, int y, int w, int h, unknowncheats::macros::texture_id user_texture_id, unknowncheats::col_t c ); 38 | 39 | void bind_animation( int id, std::string text, unknowncheats::col_t color, int font, int x, int y, text_animation_t animation_type, float animation_speed ); 40 | 41 | void clip_rect( float x, float y, float w, float h, std::function function ); 42 | 43 | unknowncheats::vec2_t text_size( const char* text, int font ); 44 | std::vector fonts{}; 45 | }; 46 | 47 | inline const auto _render = std::make_unique( ); 48 | } -------------------------------------------------------------------------------- /fhook/sdk/reverse/reversed_funcs.cpp: -------------------------------------------------------------------------------- 1 | #include "reversed_funcs.hpp" 2 | -------------------------------------------------------------------------------- /fhook/sdk/reverse/reversed_funcs.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../inc.hpp" 3 | 4 | namespace unknowncheats { 5 | class c_weapon_data { 6 | public: 7 | }; 8 | 9 | class CCSWeaponBaseVData { 10 | public: 11 | }; 12 | 13 | class reverse_t { 14 | public: 15 | c_weapon_data* get_wpn_data( ) { 16 | // sigscan: E8 ? ? ? ? 40 32 F6 F3 0F 10 3D ? ? ? ? -> im not tho very sure 17 | // return client.offset( "client.dll", "E8 ? ? ? ? 40 32 F6 F3 0F 10 3D ? ? ? ?" ) 18 | return nullptr; 19 | } 20 | 21 | CCSWeaponBaseVData* get_wpn_data2( ) { 22 | // #STR: "CCSWeaponBaseVData" 23 | // return client.offset( "client.dll", "48 8D 05 ? ? ? ? C3 CC CC CC CC CC CC CC CC 48 8B 81 ? ? ? ? F3 0F 10 80 ? ? ? ?" ) 24 | return nullptr; 25 | } 26 | 27 | void __fastcall emit_sound( ) { 28 | // E8 ? ? ? ? 41 2B F6 29 | // #STR: "CBaseEntity::EmitSound", "Sound" 30 | } 31 | 32 | std::string get_weapon_name( ) { 33 | // #STR: "Weapon '%s' script file not found, but its data was access, "" 34 | // FF 15 ? ? ? ? 84 C0 74 01 CC 48 8B C3 35 | 36 | return ""; 37 | } 38 | 39 | void __fastcall send_last_dmg_to_killer( ) { 40 | // 48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 40 4C 89 74 24 ? 41 | } 42 | }; 43 | 44 | namespace signatures { 45 | /* xref: // #STR: "Client Game", "Physics_SimulateEntity" 46 | 40 53 48 83 EC 30 48 8B D9 BA ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 48 85 C0 75 0B 48 8B 05 ? ? ? ? 48 8B 40 08 80 38 00 75 09 47 | */ 48 | } 49 | 50 | inline const auto _reverse = std::make_unique< reverse_t >( ); 51 | } -------------------------------------------------------------------------------- /fhook/thirdparty/bytes.hpp: -------------------------------------------------------------------------------- 1 | 2 | unsigned char icons_binary[ ] = { 3 | 4 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x80, 0x00, 0x03, 0x00, 0x20, 0x4F, 0x53, 0x2F, 0x32, 5 | 0x56, 0xB5, 0x63, 0x39, 0x00, 0x00, 0x01, 0x28, 0x00, 0x00, 0x00, 0x56, 0x63, 0x6D, 0x61, 0x70, 6 | 0x08, 0x9C, 0x05, 0x7C, 0x00, 0x00, 0x01, 0x9C, 0x00, 0x00, 0x01, 0x4A, 0x67, 0x6C, 0x79, 0x66, 7 | 0xEB, 0x99, 0x81, 0x31, 0x00, 0x00, 0x02, 0xF8, 0x00, 0x00, 0x03, 0x38, 0x68, 0x65, 0x61, 0x64, 8 | 0x23, 0xCE, 0x7F, 0x38, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x36, 0x68, 0x68, 0x65, 0x61, 9 | 0x08, 0x60, 0x04, 0x06, 0x00, 0x00, 0x00, 0xAC, 0x00, 0x00, 0x00, 0x24, 0x68, 0x6D, 0x74, 0x78, 10 | 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x1C, 0x6C, 0x6F, 0x63, 0x61, 11 | 0x02, 0x5A, 0x03, 0x50, 0x00, 0x00, 0x02, 0xE8, 0x00, 0x00, 0x00, 0x10, 0x6D, 0x61, 0x78, 0x70, 12 | 0x01, 0x15, 0x00, 0x54, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x20, 0x6E, 0x61, 0x6D, 0x65, 13 | 0xD5, 0x8C, 0x65, 0x24, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x02, 0x6D, 0x70, 0x6F, 0x73, 0x74, 14 | 0x03, 0x1F, 0x03, 0x0F, 0x00, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 15 | 0x04, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x04, 0x02, 0x00, 0x01, 16 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 17 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xC7, 0x30, 0xD7, 0x9A, 0x5F, 0x0F, 0x3C, 0xF5, 18 | 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x58, 0x1D, 0x1D, 0x00, 0x00, 0x00, 0x00, 19 | 0xE0, 0x58, 0x1D, 0x1D, 0xFF, 0xFF, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x08, 20 | 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x48, 21 | 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x00, 22 | 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x01, 0x90, 0x00, 0x05, 23 | 0x00, 0x08, 0x02, 0x89, 0x02, 0xCC, 0x00, 0x00, 0x00, 0x8F, 0x02, 0x89, 0x02, 0xCC, 0x00, 0x00, 24 | 0x01, 0xEB, 0x00, 0x32, 0x01, 0x08, 0x00, 0x00, 0x02, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 26 | 0x00, 0x00, 0x50, 0x66, 0x45, 0x64, 0x00, 0x40, 0x00, 0x41, 0x00, 0x46, 0x04, 0x00, 0x00, 0x00, 27 | 0x00, 0x5C, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 29 | 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 30 | 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 31 | 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 32 | 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 33 | 0x00, 0x41, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 | 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x94, 51 | 0x00, 0xE6, 0x01, 0x20, 0x01, 0x4C, 0x01, 0x9C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 52 | 0x03, 0xDE, 0x00, 0x07, 0x00, 0x0F, 0x00, 0x00, 0x25, 0x26, 0x2F, 0x01, 0x09, 0x01, 0x37, 0x09, 53 | 0x01, 0x26, 0x2F, 0x01, 0x09, 0x01, 0x37, 0x01, 0x02, 0x23, 0x07, 0x2F, 0x35, 0x01, 0x72, 0xFE, 54 | 0x8E, 0x6B, 0x01, 0xDD, 0xFC, 0x6B, 0x07, 0x2F, 0x35, 0x01, 0x72, 0xFE, 0x8E, 0x6B, 0x01, 0xDD, 55 | 0x23, 0x07, 0x2E, 0x36, 0x01, 0x72, 0x01, 0x72, 0x6B, 0xFE, 0x23, 0xFE, 0x23, 0x07, 0x2E, 0x36, 56 | 0x01, 0x72, 0x01, 0x72, 0x6B, 0xFE, 0x23, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 57 | 0x03, 0xD2, 0x00, 0x31, 0x00, 0x3B, 0x00, 0x47, 0x00, 0x00, 0x01, 0x22, 0x2B, 0x01, 0x2E, 0x01, 58 | 0x27, 0x23, 0x35, 0x3E, 0x01, 0x35, 0x2E, 0x01, 0x22, 0x06, 0x07, 0x14, 0x16, 0x17, 0x15, 0x23, 59 | 0x0E, 0x01, 0x07, 0x23, 0x22, 0x06, 0x07, 0x15, 0x1E, 0x01, 0x3B, 0x01, 0x15, 0x1E, 0x01, 0x17, 60 | 0x21, 0x3E, 0x01, 0x37, 0x35, 0x33, 0x32, 0x36, 0x37, 0x35, 0x2E, 0x01, 0x05, 0x2E, 0x01, 0x27, 61 | 0x34, 0x36, 0x37, 0x17, 0x0E, 0x01, 0x05, 0x2E, 0x01, 0x27, 0x37, 0x1E, 0x01, 0x15, 0x0E, 0x01, 62 | 0x07, 0x30, 0x03, 0xD1, 0x02, 0x15, 0x17, 0x04, 0xB7, 0x8B, 0x2E, 0x15, 0x19, 0x01, 0x34, 0x50, 63 | 0x34, 0x01, 0x19, 0x15, 0x2E, 0x8B, 0xB7, 0x04, 0x2E, 0x14, 0x1A, 0x01, 0x01, 0x1A, 0x14, 0x2E, 64 | 0x01, 0x35, 0x27, 0x02, 0x8C, 0x28, 0x34, 0x01, 0x2E, 0x14, 0x1A, 0x01, 0x01, 0x1A, 0xFD, 0x4A, 65 | 0x32, 0x42, 0x01, 0x19, 0x16, 0xB2, 0x0C, 0x3A, 0x01, 0x7C, 0x26, 0x3A, 0x0C, 0xB2, 0x16, 0x19, 66 | 0x01, 0x42, 0x32, 0x01, 0xA3, 0x8B, 0xB8, 0x03, 0x3B, 0x0C, 0x2B, 0x1A, 0x27, 0x35, 0x35, 0x27, 67 | 0x1A, 0x2B, 0x0C, 0x3B, 0x03, 0xB8, 0x8B, 0x1A, 0x14, 0x8C, 0x14, 0x1A, 0x2F, 0x28, 0x34, 0x01, 68 | 0x01, 0x34, 0x28, 0x2F, 0x1A, 0x14, 0x8C, 0x14, 0x1A, 0xBA, 0x01, 0x42, 0x32, 0x1C, 0x30, 0x11, 69 | 0x86, 0x22, 0x29, 0x01, 0x01, 0x29, 0x22, 0x86, 0x11, 0x30, 0x1C, 0x32, 0x42, 0x01, 0x00, 0x00, 70 | 0x00, 0x03, 0xFF, 0xFF, 0x00, 0x00, 0x04, 0x01, 0x03, 0xCD, 0x00, 0x1B, 0x00, 0x25, 0x00, 0x30, 71 | 0x00, 0x00, 0x13, 0x26, 0x22, 0x0F, 0x01, 0x06, 0x14, 0x1F, 0x01, 0x0E, 0x01, 0x07, 0x06, 0x14, 72 | 0x17, 0x16, 0x04, 0x17, 0x36, 0x37, 0x17, 0x16, 0x32, 0x3F, 0x01, 0x36, 0x34, 0x27, 0x25, 0x2E, 73 | 0x01, 0x27, 0x36, 0x37, 0x17, 0x06, 0x07, 0x30, 0x25, 0x26, 0x24, 0x07, 0x01, 0x36, 0x37, 0x3E, 74 | 0x01, 0x27, 0x30, 0x7A, 0x08, 0x14, 0x08, 0x1B, 0x08, 0x08, 0x85, 0x41, 0x61, 0x1B, 0x03, 0x03, 75 | 0x41, 0x01, 0x11, 0xAB, 0x7D, 0x72, 0x97, 0x07, 0x15, 0x07, 0x1C, 0x07, 0x07, 0xFE, 0x3B, 0x42, 76 | 0x56, 0x02, 0x01, 0x12, 0xCD, 0x21, 0x25, 0x01, 0xFF, 0x54, 0xFE, 0x92, 0xD1, 0x02, 0x19, 0x51, 77 | 0x26, 0x04, 0x01, 0x02, 0x03, 0xC5, 0x08, 0x08, 0x1B, 0x08, 0x14, 0x08, 0x86, 0x2C, 0x7A, 0x4A, 78 | 0x07, 0x11, 0x08, 0x9E, 0xB7, 0x01, 0x01, 0x37, 0x97, 0x07, 0x07, 0x1B, 0x08, 0x14, 0x08, 0xED, 79 | 0x01, 0x57, 0x41, 0x26, 0x22, 0xCD, 0x13, 0x01, 0xA8, 0xC7, 0xB3, 0x38, 0xFD, 0xE8, 0x4D, 0x69, 80 | 0x08, 0x11, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x0A, 81 | 0x00, 0x15, 0x00, 0x20, 0x00, 0x2B, 0x00, 0x00, 0x35, 0x32, 0x3B, 0x01, 0x15, 0x33, 0x11, 0x21, 82 | 0x15, 0x38, 0x01, 0x13, 0x22, 0x2B, 0x01, 0x15, 0x21, 0x11, 0x23, 0x15, 0x38, 0x01, 0x01, 0x32, 83 | 0x3B, 0x01, 0x35, 0x33, 0x35, 0x21, 0x11, 0x38, 0x01, 0x13, 0x34, 0x3D, 0x01, 0x23, 0x11, 0x21, 84 | 0x35, 0x23, 0x38, 0x01, 0x0E, 0x60, 0x6D, 0x93, 0xFE, 0x92, 0xDB, 0x0D, 0x60, 0x6E, 0x01, 0x6E, 85 | 0x93, 0x01, 0xB7, 0x09, 0x40, 0x4A, 0xDB, 0xFE, 0x92, 0x93, 0x93, 0x01, 0x6E, 0xDB, 0xDB, 0xDB, 86 | 0x01, 0x6E, 0x93, 0x02, 0x4A, 0x93, 0x01, 0x6E, 0xDB, 0xFC, 0xDB, 0xDB, 0x93, 0xFE, 0x92, 0x03, 87 | 0x25, 0x0D, 0x60, 0x6E, 0xFE, 0x92, 0x93, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 88 | 0x04, 0x01, 0x00, 0x0D, 0x00, 0x18, 0x00, 0x00, 0x01, 0x3E, 0x01, 0x37, 0x2E, 0x01, 0x27, 0x0E, 89 | 0x01, 0x07, 0x1E, 0x01, 0x17, 0x30, 0x15, 0x06, 0x04, 0x07, 0x15, 0x21, 0x35, 0x26, 0x24, 0x27, 90 | 0x30, 0x02, 0x01, 0x6C, 0x91, 0x03, 0x03, 0x91, 0x6C, 0x6D, 0x91, 0x03, 0x03, 0x91, 0x6D, 0x90, 91 | 0xFE, 0xA0, 0x10, 0x04, 0x00, 0x11, 0xFE, 0xA0, 0x8F, 0x02, 0x01, 0x02, 0x91, 0x6D, 0x6C, 0x91, 92 | 0x03, 0x03, 0x91, 0x6C, 0x6D, 0x91, 0x02, 0x80, 0x01, 0x80, 0x7F, 0x80, 0x80, 0x7F, 0x80, 0x01, 93 | 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x03, 0xE7, 0x00, 0x25, 0x00, 0x33, 0x00, 0x00, 94 | 0x01, 0x06, 0x0F, 0x01, 0x27, 0x26, 0x22, 0x0F, 0x01, 0x26, 0x23, 0x0E, 0x01, 0x07, 0x1E, 0x01, 95 | 0x17, 0x3E, 0x01, 0x37, 0x34, 0x27, 0x37, 0x36, 0x34, 0x2F, 0x01, 0x37, 0x3E, 0x01, 0x37, 0x33, 96 | 0x35, 0x23, 0x0E, 0x01, 0x07, 0x30, 0x01, 0x22, 0x0E, 0x02, 0x15, 0x23, 0x34, 0x3E, 0x02, 0x33, 97 | 0x15, 0x30, 0x03, 0x42, 0x03, 0x19, 0x1B, 0x38, 0x10, 0x29, 0x0F, 0x40, 0x4A, 0x4E, 0xB8, 0xF6, 98 | 0x05, 0x05, 0xF6, 0xB8, 0xB9, 0xF6, 0x04, 0x16, 0x45, 0x0F, 0x0F, 0x42, 0x38, 0x09, 0x27, 0x12, 99 | 0x33, 0x33, 0x37, 0x4E, 0x06, 0xFE, 0x71, 0x24, 0x41, 0x33, 0x1B, 0x66, 0x2A, 0x50, 0x67, 0x38, 100 | 0x03, 0xA5, 0x04, 0x18, 0x1C, 0x38, 0x0F, 0x0F, 0x40, 0x1B, 0x04, 0xF6, 0xB9, 0xB8, 0xF6, 0x05, 101 | 0x05, 0xF6, 0xB8, 0x46, 0x42, 0x45, 0x10, 0x29, 0x0F, 0x43, 0x37, 0x0A, 0x19, 0x01, 0x67, 0x04, 102 | 0x36, 0x08, 0xFE, 0xDB, 0x1B, 0x33, 0x41, 0x24, 0x39, 0x66, 0x50, 0x2B, 0x67, 0x00, 0x00, 0x00, 103 | 0x00, 0x00, 0x00, 0x12, 0x00, 0xDE, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 104 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x15, 0x00, 0x01, 105 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x00, 0x1D, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 106 | 0x00, 0x03, 0x00, 0x08, 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 107 | 0x00, 0x2C, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0B, 0x00, 0x34, 0x00, 0x01, 108 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x3F, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 109 | 0x00, 0x0A, 0x00, 0x2B, 0x00, 0x47, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x13, 110 | 0x00, 0x72, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x85, 0x00, 0x03, 111 | 0x00, 0x01, 0x04, 0x09, 0x00, 0x01, 0x00, 0x10, 0x00, 0xAF, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 112 | 0x00, 0x02, 0x00, 0x0E, 0x00, 0xBF, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x03, 0x00, 0x10, 113 | 0x00, 0xCD, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x04, 0x00, 0x10, 0x00, 0xDD, 0x00, 0x03, 114 | 0x00, 0x01, 0x04, 0x09, 0x00, 0x05, 0x00, 0x16, 0x00, 0xED, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 115 | 0x00, 0x06, 0x00, 0x10, 0x01, 0x03, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x0A, 0x00, 0x56, 116 | 0x01, 0x13, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x0B, 0x00, 0x26, 0x01, 0x69, 0x47, 0x65, 117 | 0x6E, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x47, 0x6C, 0x79, 0x70, 0x68, 118 | 0x74, 0x65, 0x72, 0x47, 0x6C, 0x79, 0x70, 0x68, 0x74, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6C, 119 | 0x61, 0x72, 0x47, 0x6C, 0x79, 0x70, 0x68, 0x74, 0x65, 0x72, 0x47, 0x6C, 0x79, 0x70, 0x68, 0x74, 120 | 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x31, 0x2E, 0x30, 0x47, 0x6C, 0x79, 121 | 0x70, 0x68, 0x74, 0x65, 0x72, 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 122 | 0x79, 0x20, 0x73, 0x76, 0x67, 0x32, 0x74, 0x74, 0x66, 0x20, 0x66, 0x72, 0x6F, 0x6D, 0x20, 0x46, 123 | 0x6F, 0x6E, 0x74, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x70, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x2E, 124 | 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x66, 0x6F, 0x6E, 0x74, 0x65, 0x6C, 0x6C, 0x6F, 0x2E, 125 | 0x63, 0x6F, 0x6D, 0x00, 0x47, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x61, 0x00, 126 | 0x74, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x62, 0x00, 0x79, 0x00, 0x20, 0x00, 0x47, 0x00, 127 | 0x6C, 0x00, 0x79, 0x00, 0x70, 0x00, 0x68, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x47, 0x00, 128 | 0x6C, 0x00, 0x79, 0x00, 0x70, 0x00, 0x68, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x52, 0x00, 129 | 0x65, 0x00, 0x67, 0x00, 0x75, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x72, 0x00, 0x47, 0x00, 0x6C, 0x00, 130 | 0x79, 0x00, 0x70, 0x00, 0x68, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x47, 0x00, 0x6C, 0x00, 131 | 0x79, 0x00, 0x70, 0x00, 0x68, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x56, 0x00, 0x65, 0x00, 132 | 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x31, 0x00, 0x2E, 0x00, 133 | 0x30, 0x00, 0x47, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x70, 0x00, 0x68, 0x00, 0x74, 0x00, 0x65, 0x00, 134 | 0x72, 0x00, 0x47, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 135 | 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x62, 0x00, 0x79, 0x00, 0x20, 0x00, 0x73, 0x00, 0x76, 0x00, 136 | 0x67, 0x00, 0x32, 0x00, 0x74, 0x00, 0x74, 0x00, 0x66, 0x00, 0x20, 0x00, 0x66, 0x00, 0x72, 0x00, 137 | 0x6F, 0x00, 0x6D, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 138 | 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x6A, 0x00, 139 | 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x2E, 0x00, 0x68, 0x00, 0x74, 0x00, 0x74, 0x00, 0x70, 0x00, 140 | 0x3A, 0x00, 0x2F, 0x00, 0x2F, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 141 | 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x00, 0x00, 142 | 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 144 | 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x07, 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 146 | }; 147 | 148 | -------------------------------------------------------------------------------- /fhook/thirdparty/custom.cpp: -------------------------------------------------------------------------------- 1 | #include "custom.hpp" 2 | using namespace ImGui; 3 | 4 | void c_custom::render_arrows_for_horizontal_bar( ImVec2 pos, float alpha, float width, float height ) { 5 | 6 | auto draw = GetWindowDrawList(); 7 | draw->AddRect( pos, pos + ImVec2( width, height ), ImColor( 0.f, 0.f, 0.f, alpha * GetStyle( ).Alpha ), 4 ); 8 | } 9 | 10 | bool c_custom::expand_button( const char* label, bool selected, float rounding, ImDrawFlags flags ) { 11 | 12 | ImGuiWindow* window = GetCurrentWindow( ); 13 | ImGuiID id = window->GetID( label ); 14 | 15 | ImVec2 label_size = CalcTextSize( label, 0, 1 ); 16 | ImVec2 icon_size = GetIO( ).Fonts->Fonts[3]->CalcTextSizeA( GetIO( ).Fonts->Fonts[3]->FontSize - 2, FLT_MAX, 0, "A" ); 17 | ImVec2 pos = window->DC.CursorPos; 18 | 19 | auto draw = window->DrawList; 20 | 21 | ImRect rect( pos, pos + ImVec2( GetWindowWidth( ), 45 ) ); 22 | ItemAdd( rect, id ); 23 | ItemSize( rect, GetStyle( ).FramePadding.y ); 24 | 25 | bool hovered, held; 26 | bool pressed = ButtonBehavior( rect, id, &hovered, &held, NULL ); 27 | 28 | static std::unordered_map < ImGuiID, float > values; 29 | auto value = values.find( id ); 30 | if ( value == values.end( ) ) { 31 | 32 | values.insert( { id, 0.f } ); 33 | value = values.find( id ); 34 | } 35 | 36 | value->second = ImLerp( value->second, ( selected ? 1.f : 0.f ), 0.035f ); 37 | 38 | draw->AddRectFilled( rect.Min, rect.Max, ImColor( 1.f, 1.f, 1.f, 0.025f * value->second ), rounding, flags ); 39 | draw->AddText( GetIO( ).Fonts->Fonts[3], GetIO( ).Fonts->Fonts[3]->FontSize - 2, ImVec2( rect.Min.x + 50 / 2 - icon_size.x / 2, rect.GetCenter( ).y - icon_size.y / 2 ), GetColorU32( ImGuiCol_Text, ( value->second > 0.3f ? value->second : 0.3f ) ), "A" ); 40 | draw->AddText( ImVec2( rect.Min.x + 50, rect.GetCenter( ).y - label_size.y / 2 ), GetColorU32( ImGuiCol_Text, ( value->second > 0.3f ? value->second : 0.3f ) ), label ); 41 | 42 | return pressed; 43 | } 44 | 45 | bool c_custom::tab( const char* icon, const char* label, bool selected ) { 46 | 47 | ImGuiWindow* window = GetCurrentWindow( ); 48 | ImGuiID id = window->GetID( label ); 49 | 50 | ImVec2 label_size = CalcTextSize( label, 0, 1 ); 51 | ImVec2 icon_size = GetIO( ).Fonts->Fonts[3]->CalcTextSizeA( GetIO( ).Fonts->Fonts[3]->FontSize, FLT_MAX, 0, icon ); 52 | ImVec2 pos = window->DC.CursorPos; 53 | 54 | auto draw = window->DrawList; 55 | 56 | ImRect rect( pos, pos + ImVec2( GetWindowWidth( ), 40 ) ); 57 | ItemAdd( rect, id ); 58 | ItemSize( rect, GetStyle( ).FramePadding.y ); 59 | 60 | bool hovered, held; 61 | bool pressed = ButtonBehavior( rect, id, &hovered, &held, NULL ); 62 | 63 | static std::unordered_map < ImGuiID, float > values; 64 | auto value = values.find( id ); 65 | if ( value == values.end( ) ) { 66 | 67 | values.insert( { id, 0.f } ); 68 | value = values.find( id ); 69 | } 70 | 71 | value->second = ImLerp( value->second, ( selected || hovered ? 1.f : 0.f ), 0.035f ); 72 | 73 | draw->AddText( GetIO( ).Fonts->Fonts[3], GetIO( ).Fonts->Fonts[3]->FontSize, ImVec2( rect.Min.x + 50 / 2 - icon_size.x / 2, rect.GetCenter( ).y - icon_size.y / 2 ), GetColorU32( ImGuiCol_Text, ( value->second > 0.3f ? value->second : 0.3f ) ), icon ); 74 | draw->AddText( ImVec2( rect.Min.x + 50, rect.GetCenter( ).y - label_size.y / 2 ), GetColorU32( ImGuiCol_Text, ( value->second > 0.3f ? value->second : 0.3f ) ), label ); 75 | 76 | return pressed; 77 | } 78 | 79 | bool c_custom::sub_tab( const char* label, bool selected ) { 80 | 81 | ImGuiWindow* window = GetCurrentWindow( ); 82 | ImGuiID id = window->GetID( label ); 83 | 84 | ImVec2 label_size = CalcTextSize( label, 0, 1 ); 85 | ImVec2 pos = window->DC.CursorPos; 86 | 87 | auto draw = window->DrawList; 88 | 89 | ImRect rect( pos, pos + label_size ); 90 | ItemAdd( rect, id ); 91 | ItemSize( ImVec4( rect.Min.x, rect.Min.y, rect.Max.x + 15, rect.Max.y ), GetStyle( ).FramePadding.y ); 92 | 93 | bool hovered, held; 94 | bool pressed = ButtonBehavior( rect, id, &hovered, &held, NULL ); 95 | 96 | static std::unordered_map < ImGuiID, float > values; 97 | auto value = values.find( id ); 98 | if ( value == values.end( ) ) { 99 | 100 | values.insert( { id, 0.f } ); 101 | value = values.find( id ); 102 | } 103 | 104 | value->second = ImLerp( value->second, ( selected ? 1.f : 0.f ), 0.035f ); 105 | 106 | draw->AddText( rect.Min, GetColorU32( ImGuiCol_Text, ( value->second > 0.3f ? value->second : 0.3f ) ), label ); 107 | draw->AddCircleFilled( ImVec2( rect.GetCenter( ).x, rect.Max.y + 10 ), 3 * value->second, custom.get_accent_color( value->second * GetStyle( ).Alpha ) ); 108 | 109 | return pressed; 110 | } 111 | 112 | struct tab_area_structure { 113 | 114 | bool hovered, should_expand; 115 | float width; 116 | }; 117 | 118 | void c_custom::tab_area( const char* str_id, ImVec2 size, std::function < void ( ) > content ) { 119 | 120 | static std::unordered_map < std::string, tab_area_structure > values; 121 | auto value = values.find( std::string( str_id ) ); 122 | if ( value == values.end( ) ) { 123 | 124 | values.insert( { std::string( str_id ), { false, false, size.x } } ); 125 | value = values.find( std::string( str_id ) ); 126 | } 127 | 128 | value->second.width = ImLerp( value->second.width, ( value->second.should_expand && value->second.hovered ) ? size.x + 60 : size.x, 0.08f ); 129 | 130 | if ( ( value->second.should_expand && value->second.hovered ) ) 131 | GetForegroundDrawList( )->AddRectFilled( GetWindowPos( ) + ImVec2( value->second.width, 0 ), GetWindowPos( ) + GetWindowSize( ), ImColor( 0.f, 0.f, 0.f, 0.2f ), GetStyle( ).WindowRounding ); 132 | 133 | PushStyleVar( ImGuiStyleVar_ItemSpacing, ImVec2( 0, 0 ) ); 134 | 135 | BeginChild( std::string( str_id ).append( ".child" ).c_str( ), ImVec2( value->second.width, size.y ) ); 136 | 137 | value->second.hovered = IsMouseHoveringRect( GetCurrentWindow( )->Pos, GetCurrentWindow( )->Pos + ImVec2( value->second.width, size.y ) ); // could use IsWindowHovered( ); , but it bugs 138 | 139 | GetWindowDrawList( )->AddRectFilled( GetCurrentWindow( )->Pos, GetCurrentWindow( )->Pos + GetCurrentWindow( )->Size, ImColor( 28, 30, 36 ), GetStyle( ).WindowRounding, ImDrawFlags_RoundCornersTopLeft ); 140 | 141 | if ( expand_button( "Expand", value->second.should_expand, GetStyle( ).WindowRounding, ImDrawFlags_RoundCornersTopLeft ) ) 142 | value->second.should_expand = !value->second.should_expand; 143 | 144 | content( ); 145 | 146 | EndChild( ); 147 | 148 | PopStyleVar( ); 149 | 150 | } 151 | 152 | bool c_custom::settings_widget( const char* u_id ) { 153 | 154 | ImGuiContext& g = *GImGui; 155 | ImGuiWindow* window = GetCurrentWindow( ); 156 | 157 | ImGuiID id = window->GetID( u_id ); 158 | 159 | ImVec2 icon_size = GetIO( ).Fonts->Fonts[ 4 ]->CalcTextSizeA( GetIO( ).Fonts->Fonts[ 4 ]->FontSize + 1, FLT_MAX, 0, "7" ); 160 | 161 | ImVec2 pos = window->DC.CursorPos; 162 | ImRect bb( pos + ImVec2( 0, 1 ), pos + icon_size + ImVec2( 0, 1 ) ); 163 | 164 | auto draw = window->DrawList; 165 | 166 | ItemAdd( bb, id ); 167 | ItemSize( bb ); 168 | 169 | bool hovered, held; 170 | bool pressed = ButtonBehavior( bb, id, &hovered, &held ); 171 | 172 | static std::unordered_map < ImGuiID, float > values; 173 | auto value = values.find( id ); 174 | if ( value == values.end( ) ) { 175 | 176 | values.insert( { id, { 0.f } } ); 177 | value = values.find( id ); 178 | } 179 | 180 | value->second = ImLerp( value->second, ( hovered ? 1.f : 0.5f ), 0.035f ); 181 | 182 | //' ne4 183 | draw->AddText( GetIO( ).Fonts->Fonts[ 4 ], GetIO( ).Fonts->Fonts[ 4 ]->FontSize + 1, bb.Min, GetColorU32( ImGuiCol_Text, value->second ), "7" ); 184 | 185 | return pressed; 186 | } 187 | 188 | void c_custom::prepared_popup( const char* id, const char* name, std::function content ) { 189 | 190 | ImGui::SetNextWindowSize( { 230,230 } ); 191 | 192 | ImGui::PushStyleVar( ImGuiStyleVar_ItemSpacing, { 8,11 } ); 193 | ImGui::PushStyleVar( ImGuiStyleVar_PopupRounding, 4 ); 194 | ImGui::PushStyleColor( ImGuiCol_PopupBg, ImVec4( ImColor( 21, 20, 27 ) ) ); 195 | PushStyleColor( ImGuiCol_Border, ImVec4( 1.f, 1.f, 1.f, 0.05f ) ); 196 | 197 | if ( ImGui::BeginPopup( id ) ) { 198 | 199 | auto pos = ImGui::GetCurrentWindow( )->Pos, size = ImGui::GetCurrentWindow( )->Size; 200 | //ImGui::GetCurrentWindow( )->DrawList->AddText( ImGui::GetIO( ).Fonts->Fonts[ 2 ], ImGui::GetIO( ).Fonts->Fonts[ 2 ]->FontSize - 2, ImVec2( pos.x + 15, pos.y + 10 ), ImColor( 1.f, 1.f, 1.f ), name ); 201 | //ImGui::GetCurrentWindow( )->DrawList->AddLine( ImVec2( pos.x + 10, pos.y + 35 ), ImVec2( pos.x + size.x - 10, pos.y + 35 ), ImColor( 1.f, 1.f, 1.f, 0.1f ), 2 ); 202 | 203 | ImGui::SetCursorPos( { 10, 10 } ); 204 | custom.group_box_alternative( id, ImVec2( size.x - 20, size.y - 20 ) ); 205 | 206 | content( ); 207 | 208 | custom.end_group_box_alternative( ); 209 | 210 | 211 | ImGui::EndPopup( ); 212 | } 213 | 214 | ImGui::PopStyleColor( 2 ); 215 | ImGui::PopStyleVar( 2 ); 216 | } 217 | 218 | void c_custom::group_box_alternative( const char* name, ImVec2 size_arg, ImVec2 padding ) { 219 | 220 | ImGuiWindow* window = GetCurrentWindow( ); 221 | ImVec2 pos = window->DC.CursorPos; 222 | 223 | auto name_size = GetIO( ).Fonts->Fonts[ 1 ]->CalcTextSizeA( GetIO( ).Fonts->Fonts[ 1 ]->FontSize, FLT_MAX, 0.f, name ); 224 | 225 | BeginChild( std::string( name ).append( ".main" ).c_str( ), size_arg, false, ImGuiWindowFlags_NoScrollbar ); 226 | 227 | GetWindowDrawList( )->AddRectFilled( pos, pos + size_arg, to_vec4( 28, 30, 36, custom.m_anim * GetStyle( ).Alpha ), 3 ); 228 | GetWindowDrawList( )->AddText( pos + ImVec2( 10, 8 ), custom.get_accent_color( custom.m_anim * GetStyle( ).Alpha ), name, FindRenderedTextEnd( name ) ); 229 | 230 | SetCursorPosY( padding.y ); 231 | BeginChild( name, { size_arg.x, size_arg.y - padding.y } ); 232 | SetCursorPosX( padding.x ); 233 | 234 | BeginGroup( ); 235 | 236 | GetWindowDrawList( )->AddText( pos + ImVec2( 10, 8 ), custom.get_accent_color( custom.m_anim ), name, FindRenderedTextEnd( name ) ); 237 | 238 | PushStyleVar( ImGuiStyleVar_ItemSpacing, { 8, 8 } ); 239 | PushStyleVar( ImGuiStyleVar_Alpha, custom.m_anim * GetStyle( ).Alpha ); 240 | } 241 | 242 | void c_custom::end_group_box_alternative( ) { 243 | 244 | PopStyleVar( 2 ); 245 | EndGroup( ); 246 | EndChild( ); 247 | EndChild( ); 248 | } 249 | 250 | 251 | void c_custom::begin_child( const char* name, ImVec2 size ) { 252 | 253 | ImGuiContext& g = *GImGui; 254 | ImGuiWindow* window = GetCurrentWindow( ); 255 | 256 | ImVec2 pos = window->DC.CursorPos; 257 | 258 | BeginChild( std::string( name ).append( ".main" ).c_str( ), size, false, ImGuiWindowFlags_NoScrollbar ); 259 | 260 | GetWindowDrawList( )->AddRectFilled( pos, pos + size, to_vec4( 28, 30, 36, custom.m_anim ), 4 ); 261 | GetWindowDrawList( )->AddText( pos + ImVec2( 10, 8 ), custom.get_accent_color( custom.m_anim ), name, FindRenderedTextEnd( name ) ); 262 | 263 | SetCursorPosY( 30 ); 264 | BeginChild( name, { size.x, size.y - 30 } ); 265 | SetCursorPosX( 10 ); 266 | 267 | BeginGroup( ); 268 | 269 | PushStyleVar( ImGuiStyleVar_Alpha, custom.m_anim ); 270 | PushStyleVar( ImGuiStyleVar_ItemSpacing, { 8, 8 } ); 271 | } 272 | 273 | void c_custom::end_child( ) { 274 | 275 | PopStyleVar( 2 ); 276 | EndGroup( ); 277 | EndChild( ); 278 | EndChild( ); 279 | } 280 | -------------------------------------------------------------------------------- /fhook/thirdparty/custom.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IMGUI_DEFINE_MATH_OPERATORS 4 | #include "imgui.h" 5 | #include "imgui_internal.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define to_vec4( r, g, b, a ) ImColor( r / 255.f, g / 255.f, b / 255.f, a ) 14 | 15 | class c_custom { 16 | 17 | public: 18 | float m_anim = 0.f; 19 | 20 | int m_tab = 0; 21 | vector < const char* > tabs = { "Rage", "Visuals", "Misc", "Profile", "Scripts" }, tabs_icons = { "B", "C", "D", "E", "F" }; 22 | 23 | int m_rage_subtab = 0; 24 | vector < const char* > rage_subtabs = { "Legitbot", "Ragebot", "Other" }; 25 | 26 | int m_visuals_subtab = 0; 27 | vector < const char* > visuals_subtabs = { "Players", "World" }; 28 | 29 | float col_buf[4] = { 1.f, 1.f, 1.f, 1.f }; 30 | 31 | void render_arrows_for_horizontal_bar( ImVec2 pos, float alpha, float width, float height ); 32 | 33 | void prepared_popup( const char* id, const char* name, std::function content ); 34 | void group_box_alternative( const char* name, ImVec2 size_arg, ImVec2 padding = ImVec2( 12, 12 ) ); 35 | void end_group_box_alternative( ); 36 | bool settings_widget( const char* u_id ); 37 | 38 | bool expand_button( const char* label, bool selected, float rounding = 0.f, ImDrawFlags flags = NULL ); 39 | bool tab( const char* icon, const char* label, bool selected ); 40 | bool sub_tab( const char* label, bool selected ); 41 | 42 | void tab_area( const char* str_id, ImVec2 size, std::function < void ( ) > content ); 43 | 44 | void begin_child( const char* name, ImVec2 size ); 45 | void end_child( ); 46 | 47 | int accent_color[4] = { 140, 131, 214, 255 }; 48 | ImColor get_accent_color( float a = 1.f ) { 49 | 50 | return to_vec4( accent_color[0], accent_color[1], accent_color[2], a ); 51 | } 52 | 53 | }; 54 | 55 | inline c_custom custom; 56 | -------------------------------------------------------------------------------- /fhook/thirdparty/freetype/include&lib.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reezliabi/CS2-External-Usermode/8dd02220a5aec036c9cb3604111400e17901e8e2/fhook/thirdparty/freetype/include&lib.zip -------------------------------------------------------------------------------- /fhook/thirdparty/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | // DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 25 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 26 | //#define IMGUI_API __declspec( dllexport ) 27 | //#define IMGUI_API __declspec( dllimport ) 28 | 29 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 30 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 31 | //#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. 32 | 33 | //---- Disable all of Dear ImGui or don't implement standard windows/tools. 34 | // It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. 35 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 36 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. 37 | //#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88). 38 | 39 | //---- Don't implement some functions to reduce linkage requirements. 40 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 41 | //#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW) 42 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a) 43 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 44 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 45 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 46 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 47 | //#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies) 48 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 49 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 50 | //#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available 51 | 52 | //---- Include imgui_user.h at the end of imgui.h as a convenience 53 | //#define IMGUI_INCLUDE_IMGUI_USER_H 54 | 55 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 56 | //#define IMGUI_USE_BGRA_PACKED_COLOR 57 | 58 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 59 | //#define IMGUI_USE_WCHAR32 60 | 61 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 62 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 63 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 64 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 65 | //#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled 66 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 67 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 68 | 69 | //---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 70 | // Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. 71 | //#define IMGUI_USE_STB_SPRINTF 72 | 73 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 74 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 75 | // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. 76 | //#define IMGUI_ENABLE_FREETYPE 77 | 78 | //---- Use stb_truetype to build and rasterize the font atlas (default) 79 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 80 | //#define IMGUI_ENABLE_STB_TRUETYPE 81 | 82 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 83 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 84 | /* 85 | #define IM_VEC2_CLASS_EXTRA \ 86 | constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ 87 | operator MyVec2() const { return MyVec2(x,y); } 88 | 89 | #define IM_VEC4_CLASS_EXTRA \ 90 | constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ 91 | operator MyVec4() const { return MyVec4(x,y,z,w); } 92 | */ 93 | //---- ...Or use Dear ImGui's own very basic math operators. 94 | //#define IMGUI_DEFINE_MATH_OPERATORS 95 | 96 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 97 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 98 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 99 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 100 | //#define ImDrawIdx unsigned int 101 | 102 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 103 | //struct ImDrawList; 104 | //struct ImDrawCmd; 105 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 106 | //#define ImDrawCallback MyImDrawCallback 107 | 108 | //---- Debug Tools: Macro to break in Debugger 109 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 110 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 111 | //#define IM_DEBUG_BREAK __debugbreak() 112 | 113 | //---- Debug Tools: Enable slower asserts 114 | //#define IMGUI_DEBUG_PARANOID 115 | 116 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 117 | /* 118 | namespace ImGui 119 | { 120 | void MyFunction(const char* name, const MyMatrix44& v); 121 | } 122 | */ 123 | #define IMGUI_DEFINE_MATH_OPERATORS -------------------------------------------------------------------------------- /fhook/thirdparty/imgui_freetype.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // dear imgui: FreeType font builder (used as a replacement for the stb_truetype builder) 3 | // (headers) 4 | 5 | #pragma once 6 | 7 | #include "imgui.h" // IMGUI_API 8 | 9 | // Forward declarations 10 | struct ImFontAtlas; 11 | struct ImFontBuilderIO; 12 | 13 | // Hinting greatly impacts visuals (and glyph sizes). 14 | // - By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter. 15 | // - When disabled, FreeType generates blurrier glyphs, more or less matches the stb_truetype.h 16 | // - The Default hinting mode usually looks good, but may distort glyphs in an unusual way. 17 | // - The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer. 18 | // You can set those flags globaly in ImFontAtlas::FontBuilderFlags 19 | // You can set those flags on a per font basis in ImFontConfig::FontBuilderFlags 20 | enum ImGuiFreeTypeBuilderFlags { 21 | ImGuiFreeTypeBuilderFlags_NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes. 22 | ImGuiFreeTypeBuilderFlags_NoAutoHint = 1 << 1, // Disable auto-hinter. 23 | ImGuiFreeTypeBuilderFlags_ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter. 24 | ImGuiFreeTypeBuilderFlags_LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text. 25 | ImGuiFreeTypeBuilderFlags_MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output. 26 | ImGuiFreeTypeBuilderFlags_Bold = 1 << 5, // Styling: Should we artificially embolden the font? 27 | ImGuiFreeTypeBuilderFlags_Oblique = 1 << 6, // Styling: Should we slant the font, emulating italic style? 28 | ImGuiFreeTypeBuilderFlags_Monochrome = 1 << 7, // Disable anti-aliasing. Combine this with MonoHinting for best results! 29 | ImGuiFreeTypeBuilderFlags_LoadColor = 1 << 8, // Enable FreeType color-layered glyphs 30 | ImGuiFreeTypeBuilderFlags_Bitmap = 1 << 9 // Enable FreeType bitmap glyphs 31 | }; 32 | 33 | namespace ImGuiFreeType { 34 | // This is automatically assigned when using '#define IMGUI_ENABLE_FREETYPE'. 35 | // If you need to dynamically select between multiple builders: 36 | // - you can manually assign this builder with 'atlas->FontBuilderIO = ImGuiFreeType::GetBuilderForFreeType()' 37 | // - prefer deep-copying this into your own ImFontBuilderIO instance if you use hot-reloading that messes up static data. 38 | IMGUI_API const ImFontBuilderIO* GetBuilderForFreeType( ); 39 | 40 | // Override allocators. By default ImGuiFreeType will use IM_ALLOC()/IM_FREE() 41 | // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired. 42 | IMGUI_API void SetAllocatorFunctions( void* ( *alloc_func )( size_t sz, void* user_data ), void ( *free_func )( void* ptr, void* user_data ), void* user_data = nullptr ); 43 | 44 | // Obsolete names (will be removed soon) 45 | // Prefer using '#define IMGUI_ENABLE_FREETYPE' 46 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS 47 | static inline bool BuildFontAtlas( ImFontAtlas* atlas, unsigned int flags = 0 ) { atlas->FontBuilderIO = GetBuilderForFreeType( ); atlas->FontBuilderFlags = flags; return atlas->Build( ); } 48 | #endif 49 | } -------------------------------------------------------------------------------- /fhook/thirdparty/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices. 7 | 8 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 9 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct ID3D11Device; 17 | struct ID3D11DeviceContext; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 20 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 22 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 23 | 24 | // Use if you want to reset your rendering device without losing Dear ImGui state. 25 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 26 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 27 | -------------------------------------------------------------------------------- /fhook/thirdparty/imgui_impl_dx9.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX9 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices. 7 | 8 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 9 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | // CHANGELOG 14 | // (minor and older changes stripped away, please see git history for details) 15 | // 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11. 16 | // 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX). 17 | // 2021-06-25: DirectX9: Explicitly disable texture state stages after >= 1. 18 | // 2021-05-19: DirectX9: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement) 19 | // 2021-04-23: DirectX9: Explicitly setting up more graphics states to increase compatibility with unusual non-default states. 20 | // 2021-03-18: DirectX9: Calling IDirect3DStateBlock9::Capture() after CreateStateBlock() as a workaround for state restoring issues (see #3857). 21 | // 2021-03-03: DirectX9: Added support for IMGUI_USE_BGRA_PACKED_COLOR in user's imconfig file. 22 | // 2021-02-18: DirectX9: Change blending equation to preserve alpha in output buffer. 23 | // 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag. 24 | // 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state. 25 | // 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects(). 26 | // 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288. 27 | // 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window. 28 | // 2018-06-08: Misc: Extracted imgui_impl_dx9.cpp/.h away from the old combined DX9+Win32 example. 29 | // 2018-06-08: DirectX9: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle. 30 | // 2018-05-07: Render: Saving/restoring Transform because they don't seem to be included in the StateBlock. Setting shading mode to Gouraud. 31 | // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself. 32 | // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves. 33 | 34 | #include "imgui.h" 35 | #include "imgui_impl_dx9.h" 36 | 37 | // DirectX 38 | #include 39 | 40 | // DirectX data 41 | struct ImGui_ImplDX9_Data 42 | { 43 | LPDIRECT3DDEVICE9 pd3dDevice; 44 | LPDIRECT3DVERTEXBUFFER9 pVB; 45 | LPDIRECT3DINDEXBUFFER9 pIB; 46 | LPDIRECT3DTEXTURE9 FontTexture; 47 | int VertexBufferSize; 48 | int IndexBufferSize; 49 | 50 | ImGui_ImplDX9_Data() { memset((void*)this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } 51 | }; 52 | 53 | struct CUSTOMVERTEX 54 | { 55 | float pos[3]; 56 | D3DCOLOR col; 57 | float uv[2]; 58 | }; 59 | #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) 60 | 61 | #ifdef IMGUI_USE_BGRA_PACKED_COLOR 62 | #define IMGUI_COL_TO_DX9_ARGB(_COL) (_COL) 63 | #else 64 | #define IMGUI_COL_TO_DX9_ARGB(_COL) (((_COL) & 0xFF00FF00) | (((_COL) & 0xFF0000) >> 16) | (((_COL) & 0xFF) << 16)) 65 | #endif 66 | 67 | // Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts 68 | // It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts. 69 | static ImGui_ImplDX9_Data* ImGui_ImplDX9_GetBackendData() 70 | { 71 | return ImGui::GetCurrentContext() ? (ImGui_ImplDX9_Data*)ImGui::GetIO().BackendRendererUserData : nullptr; 72 | } 73 | 74 | // Functions 75 | static void ImGui_ImplDX9_SetupRenderState(ImDrawData* draw_data) 76 | { 77 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 78 | 79 | // Setup viewport 80 | D3DVIEWPORT9 vp; 81 | vp.X = vp.Y = 0; 82 | vp.Width = (DWORD)draw_data->DisplaySize.x; 83 | vp.Height = (DWORD)draw_data->DisplaySize.y; 84 | vp.MinZ = 0.0f; 85 | vp.MaxZ = 1.0f; 86 | bd->pd3dDevice->SetViewport(&vp); 87 | 88 | // Setup render state: fixed-pipeline, alpha-blending, no face culling, no depth testing, shade mode (for gradient), bilinear sampling. 89 | bd->pd3dDevice->SetPixelShader(nullptr); 90 | bd->pd3dDevice->SetVertexShader(nullptr); 91 | bd->pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); 92 | bd->pd3dDevice->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD); 93 | bd->pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); 94 | bd->pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); 95 | bd->pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); 96 | bd->pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE); 97 | bd->pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); 98 | bd->pd3dDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); 99 | bd->pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); 100 | bd->pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); 101 | bd->pd3dDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE); 102 | bd->pd3dDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE); 103 | bd->pd3dDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA); 104 | bd->pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); 105 | bd->pd3dDevice->SetRenderState(D3DRS_FOGENABLE, FALSE); 106 | bd->pd3dDevice->SetRenderState(D3DRS_RANGEFOGENABLE, FALSE); 107 | bd->pd3dDevice->SetRenderState(D3DRS_SPECULARENABLE, FALSE); 108 | bd->pd3dDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE); 109 | bd->pd3dDevice->SetRenderState(D3DRS_CLIPPING, TRUE); 110 | bd->pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE); 111 | bd->pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); 112 | bd->pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); 113 | bd->pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); 114 | bd->pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); 115 | bd->pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); 116 | bd->pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); 117 | bd->pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE); 118 | bd->pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); 119 | bd->pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); 120 | bd->pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); 121 | 122 | // Setup orthographic projection matrix 123 | // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps. 124 | // Being agnostic of whether or can be used, we aren't relying on D3DXMatrixIdentity()/D3DXMatrixOrthoOffCenterLH() or DirectX::XMMatrixIdentity()/DirectX::XMMatrixOrthographicOffCenterLH() 125 | { 126 | float L = draw_data->DisplayPos.x + 0.5f; 127 | float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x + 0.5f; 128 | float T = draw_data->DisplayPos.y + 0.5f; 129 | float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y + 0.5f; 130 | D3DMATRIX mat_identity = { { { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } } }; 131 | D3DMATRIX mat_projection = 132 | { { { 133 | 2.0f/(R-L), 0.0f, 0.0f, 0.0f, 134 | 0.0f, 2.0f/(T-B), 0.0f, 0.0f, 135 | 0.0f, 0.0f, 0.5f, 0.0f, 136 | (L+R)/(L-R), (T+B)/(B-T), 0.5f, 1.0f 137 | } } }; 138 | bd->pd3dDevice->SetTransform(D3DTS_WORLD, &mat_identity); 139 | bd->pd3dDevice->SetTransform(D3DTS_VIEW, &mat_identity); 140 | bd->pd3dDevice->SetTransform(D3DTS_PROJECTION, &mat_projection); 141 | } 142 | } 143 | 144 | // Render function. 145 | void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data) 146 | { 147 | // Avoid rendering when minimized 148 | if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f) 149 | return; 150 | 151 | // Create and grow buffers if needed 152 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 153 | if (!bd->pVB || bd->VertexBufferSize < draw_data->TotalVtxCount) 154 | { 155 | if (bd->pVB) { bd->pVB->Release(); bd->pVB = nullptr; } 156 | bd->VertexBufferSize = draw_data->TotalVtxCount + 5000; 157 | if (bd->pd3dDevice->CreateVertexBuffer(bd->VertexBufferSize * sizeof(CUSTOMVERTEX), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &bd->pVB, nullptr) < 0) 158 | return; 159 | } 160 | if (!bd->pIB || bd->IndexBufferSize < draw_data->TotalIdxCount) 161 | { 162 | if (bd->pIB) { bd->pIB->Release(); bd->pIB = nullptr; } 163 | bd->IndexBufferSize = draw_data->TotalIdxCount + 10000; 164 | if (bd->pd3dDevice->CreateIndexBuffer(bd->IndexBufferSize * sizeof(ImDrawIdx), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, sizeof(ImDrawIdx) == 2 ? D3DFMT_INDEX16 : D3DFMT_INDEX32, D3DPOOL_DEFAULT, &bd->pIB, nullptr) < 0) 165 | return; 166 | } 167 | 168 | // Backup the DX9 state 169 | IDirect3DStateBlock9* d3d9_state_block = nullptr; 170 | if (bd->pd3dDevice->CreateStateBlock(D3DSBT_ALL, &d3d9_state_block) < 0) 171 | return; 172 | if (d3d9_state_block->Capture() < 0) 173 | { 174 | d3d9_state_block->Release(); 175 | return; 176 | } 177 | 178 | // Backup the DX9 transform (DX9 documentation suggests that it is included in the StateBlock but it doesn't appear to) 179 | D3DMATRIX last_world, last_view, last_projection; 180 | bd->pd3dDevice->GetTransform(D3DTS_WORLD, &last_world); 181 | bd->pd3dDevice->GetTransform(D3DTS_VIEW, &last_view); 182 | bd->pd3dDevice->GetTransform(D3DTS_PROJECTION, &last_projection); 183 | 184 | // Allocate buffers 185 | CUSTOMVERTEX* vtx_dst; 186 | ImDrawIdx* idx_dst; 187 | if (bd->pVB->Lock(0, (UINT)(draw_data->TotalVtxCount * sizeof(CUSTOMVERTEX)), (void**)&vtx_dst, D3DLOCK_DISCARD) < 0) 188 | { 189 | d3d9_state_block->Release(); 190 | return; 191 | } 192 | if (bd->pIB->Lock(0, (UINT)(draw_data->TotalIdxCount * sizeof(ImDrawIdx)), (void**)&idx_dst, D3DLOCK_DISCARD) < 0) 193 | { 194 | bd->pVB->Unlock(); 195 | d3d9_state_block->Release(); 196 | return; 197 | } 198 | 199 | // Copy and convert all vertices into a single contiguous buffer, convert colors to DX9 default format. 200 | // FIXME-OPT: This is a minor waste of resource, the ideal is to use imconfig.h and 201 | // 1) to avoid repacking colors: #define IMGUI_USE_BGRA_PACKED_COLOR 202 | // 2) to avoid repacking vertices: #define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; } 203 | for (int n = 0; n < draw_data->CmdListsCount; n++) 204 | { 205 | const ImDrawList* cmd_list = draw_data->CmdLists[n]; 206 | const ImDrawVert* vtx_src = cmd_list->VtxBuffer.Data; 207 | for (int i = 0; i < cmd_list->VtxBuffer.Size; i++) 208 | { 209 | vtx_dst->pos[0] = vtx_src->pos.x; 210 | vtx_dst->pos[1] = vtx_src->pos.y; 211 | vtx_dst->pos[2] = 0.0f; 212 | vtx_dst->col = IMGUI_COL_TO_DX9_ARGB(vtx_src->col); 213 | vtx_dst->uv[0] = vtx_src->uv.x; 214 | vtx_dst->uv[1] = vtx_src->uv.y; 215 | vtx_dst++; 216 | vtx_src++; 217 | } 218 | memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx)); 219 | idx_dst += cmd_list->IdxBuffer.Size; 220 | } 221 | bd->pVB->Unlock(); 222 | bd->pIB->Unlock(); 223 | bd->pd3dDevice->SetStreamSource(0, bd->pVB, 0, sizeof(CUSTOMVERTEX)); 224 | bd->pd3dDevice->SetIndices(bd->pIB); 225 | bd->pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX); 226 | 227 | // Setup desired DX state 228 | ImGui_ImplDX9_SetupRenderState(draw_data); 229 | 230 | // Render command lists 231 | // (Because we merged all buffers into a single one, we maintain our own offset into them) 232 | int global_vtx_offset = 0; 233 | int global_idx_offset = 0; 234 | ImVec2 clip_off = draw_data->DisplayPos; 235 | for (int n = 0; n < draw_data->CmdListsCount; n++) 236 | { 237 | const ImDrawList* cmd_list = draw_data->CmdLists[n]; 238 | for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) 239 | { 240 | const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; 241 | if (pcmd->UserCallback != nullptr) 242 | { 243 | // User callback, registered via ImDrawList::AddCallback() 244 | // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.) 245 | if (pcmd->UserCallback == ImDrawCallback_ResetRenderState) 246 | ImGui_ImplDX9_SetupRenderState(draw_data); 247 | else 248 | pcmd->UserCallback(cmd_list, pcmd); 249 | } 250 | else 251 | { 252 | // Project scissor/clipping rectangles into framebuffer space 253 | ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y); 254 | ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y); 255 | if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) 256 | continue; 257 | 258 | // Apply Scissor/clipping rectangle, Bind texture, Draw 259 | const RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y }; 260 | const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->GetTexID(); 261 | bd->pd3dDevice->SetTexture(0, texture); 262 | bd->pd3dDevice->SetScissorRect(&r); 263 | bd->pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, pcmd->VtxOffset + global_vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, pcmd->IdxOffset + global_idx_offset, pcmd->ElemCount / 3); 264 | } 265 | } 266 | global_idx_offset += cmd_list->IdxBuffer.Size; 267 | global_vtx_offset += cmd_list->VtxBuffer.Size; 268 | } 269 | 270 | // Restore the DX9 transform 271 | bd->pd3dDevice->SetTransform(D3DTS_WORLD, &last_world); 272 | bd->pd3dDevice->SetTransform(D3DTS_VIEW, &last_view); 273 | bd->pd3dDevice->SetTransform(D3DTS_PROJECTION, &last_projection); 274 | 275 | // Restore the DX9 state 276 | d3d9_state_block->Apply(); 277 | d3d9_state_block->Release(); 278 | } 279 | 280 | bool ImGui_ImplDX9_Init(IDirect3DDevice9* device) 281 | { 282 | ImGuiIO& io = ImGui::GetIO(); 283 | IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!"); 284 | 285 | // Setup backend capabilities flags 286 | ImGui_ImplDX9_Data* bd = IM_NEW(ImGui_ImplDX9_Data)(); 287 | io.BackendRendererUserData = (void*)bd; 288 | io.BackendRendererName = "imgui_impl_dx9"; 289 | io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes. 290 | 291 | bd->pd3dDevice = device; 292 | bd->pd3dDevice->AddRef(); 293 | 294 | return true; 295 | } 296 | 297 | void ImGui_ImplDX9_Shutdown() 298 | { 299 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 300 | IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?"); 301 | ImGuiIO& io = ImGui::GetIO(); 302 | 303 | ImGui_ImplDX9_InvalidateDeviceObjects(); 304 | if (bd->pd3dDevice) { bd->pd3dDevice->Release(); } 305 | io.BackendRendererName = nullptr; 306 | io.BackendRendererUserData = nullptr; 307 | IM_DELETE(bd); 308 | } 309 | 310 | static bool ImGui_ImplDX9_CreateFontsTexture() 311 | { 312 | // Build texture atlas 313 | ImGuiIO& io = ImGui::GetIO(); 314 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 315 | unsigned char* pixels; 316 | int width, height, bytes_per_pixel; 317 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height, &bytes_per_pixel); 318 | 319 | // Convert RGBA32 to BGRA32 (because RGBA32 is not well supported by DX9 devices) 320 | #ifndef IMGUI_USE_BGRA_PACKED_COLOR 321 | if (io.Fonts->TexPixelsUseColors) 322 | { 323 | ImU32* dst_start = (ImU32*)ImGui::MemAlloc((size_t)width * height * bytes_per_pixel); 324 | for (ImU32* src = (ImU32*)pixels, *dst = dst_start, *dst_end = dst_start + (size_t)width * height; dst < dst_end; src++, dst++) 325 | *dst = IMGUI_COL_TO_DX9_ARGB(*src); 326 | pixels = (unsigned char*)dst_start; 327 | } 328 | #endif 329 | 330 | // Upload texture to graphics system 331 | bd->FontTexture = nullptr; 332 | if (bd->pd3dDevice->CreateTexture(width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &bd->FontTexture, nullptr) < 0) 333 | return false; 334 | D3DLOCKED_RECT tex_locked_rect; 335 | if (bd->FontTexture->LockRect(0, &tex_locked_rect, nullptr, 0) != D3D_OK) 336 | return false; 337 | for (int y = 0; y < height; y++) 338 | memcpy((unsigned char*)tex_locked_rect.pBits + (size_t)tex_locked_rect.Pitch * y, pixels + (size_t)width * bytes_per_pixel * y, (size_t)width * bytes_per_pixel); 339 | bd->FontTexture->UnlockRect(0); 340 | 341 | // Store our identifier 342 | io.Fonts->SetTexID((ImTextureID)bd->FontTexture); 343 | 344 | #ifndef IMGUI_USE_BGRA_PACKED_COLOR 345 | if (io.Fonts->TexPixelsUseColors) 346 | ImGui::MemFree(pixels); 347 | #endif 348 | 349 | return true; 350 | } 351 | 352 | bool ImGui_ImplDX9_CreateDeviceObjects() 353 | { 354 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 355 | if (!bd || !bd->pd3dDevice) 356 | return false; 357 | if (!ImGui_ImplDX9_CreateFontsTexture()) 358 | return false; 359 | return true; 360 | } 361 | 362 | void ImGui_ImplDX9_InvalidateDeviceObjects() 363 | { 364 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 365 | if (!bd || !bd->pd3dDevice) 366 | return; 367 | if (bd->pVB) { bd->pVB->Release(); bd->pVB = nullptr; } 368 | if (bd->pIB) { bd->pIB->Release(); bd->pIB = nullptr; } 369 | if (bd->FontTexture) { bd->FontTexture->Release(); bd->FontTexture = nullptr; ImGui::GetIO().Fonts->SetTexID(0); } // We copied bd->pFontTextureView to io.Fonts->TexID so let's clear that as well. 370 | } 371 | 372 | void ImGui_ImplDX9_NewFrame() 373 | { 374 | ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); 375 | IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplDX9_Init()?"); 376 | 377 | if (!bd->FontTexture) 378 | ImGui_ImplDX9_CreateDeviceObjects(); 379 | } 380 | -------------------------------------------------------------------------------- /fhook/thirdparty/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX9 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices. 7 | 8 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 9 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct IDirect3DDevice9; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 19 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 25 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /fhook/thirdparty/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32-bits AND 64-bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen. 7 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 14 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 15 | 16 | #pragma once 17 | #include "imgui.h" // IMGUI_IMPL_API 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 20 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 22 | 23 | // Win32 message handler your application need to call. 24 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 25 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 26 | // - Call from your application's message handler. Keep calling your message handler unless this function returns TRUE. 27 | 28 | #if 0 29 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 30 | #endif 31 | 32 | // DPI-related helpers (optional) 33 | // - Use to enable DPI awareness without having to create an application manifest. 34 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 35 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 36 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 37 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 38 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 39 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 40 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 41 | 42 | // Transparency related helpers (optional) [experimental] 43 | // - Use to enable alpha compositing transparency with the desktop. 44 | // - Use together with e.g. clearing your framebuffer with zero-alpha. 45 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd 46 | --------------------------------------------------------------------------------