├── .gitattributes ├── .gitignore ├── README.md ├── internal_public.sln └── lunar_csgo_recode ├── external ├── fonts │ └── cs.hh ├── hasher │ ├── hasher.cc │ └── hasher.hh ├── hooking │ ├── buffer.c │ ├── buffer.h │ ├── hde │ │ ├── hde32.c │ │ ├── hde32.h │ │ ├── hde64.c │ │ ├── hde64.h │ │ ├── pstdint.h │ │ ├── table32.h │ │ └── table64.h │ ├── hook.c │ ├── minhook.hh │ ├── trampoline.c │ └── trampoline.h ├── javascript │ ├── v7.cc │ └── v7.hh ├── textures │ └── textures.hh └── xor │ └── xor.hh ├── hack ├── game │ ├── addresses.hh │ ├── globals.hh │ ├── interfaces.hh │ ├── modules.hh │ ├── netvars.cc │ ├── netvars.hh │ └── renderer.hh ├── hooks │ ├── functions │ │ ├── buildtransofrmations.cc │ │ ├── calcviewbob.cc │ │ ├── clmove.cc │ │ ├── createentity.cc │ │ ├── createmove.cc │ │ ├── doanimationevent.cc │ │ ├── doenginepostprocessing.cc │ │ ├── doextraboneprocessing.cc │ │ ├── doproceduralfootplant.cc │ │ ├── drawprinttext.cc │ │ ├── endscene.cc │ │ ├── fireevent.cc │ │ ├── framestagenotify.cc │ │ ├── getalphamodulation.cc │ │ ├── getcolormodulation.cc │ │ ├── getviewangles.cc │ │ ├── inprediction.cc │ │ ├── interpolateserverentities.cc │ │ ├── ishltv.cc │ │ ├── isusingstaticpropdebug.cc │ │ ├── levelshutdown.cc │ │ ├── lockcursor.cc │ │ ├── overrideview.cc │ │ ├── painttraverse.cc │ │ ├── performprediction.cc │ │ ├── reset.cc │ │ ├── runcommand.cc │ │ ├── setupbones.cc │ │ ├── shouldinterpolate.cc │ │ ├── shouldskipanimframe.cc │ │ ├── standardblendingrules.cc │ │ ├── svcheatsgetbool.cc │ │ ├── update.cc │ │ ├── updateclientsideanimations.cc │ │ ├── vertexbufferdx10lock.cc │ │ └── writeucmddeltatobuffer.cc │ └── handler.hh ├── menu │ ├── config.hh │ ├── controls │ │ ├── c_checkbox.cc │ │ ├── c_colorpicker.cc │ │ ├── c_combobox.cc │ │ ├── c_form.cc │ │ ├── c_groupbox.cc │ │ ├── c_home.cc │ │ ├── c_keybind.cc │ │ ├── c_multicombobox.cc │ │ ├── c_slider.cc │ │ └── c_window.cc │ ├── framework.hh │ └── implementation.cc └── modules │ ├── animations │ ├── animations.cc │ └── animations.hh │ ├── misc │ ├── movement.cc │ ├── movement.hh │ ├── others.cc │ └── others.hh │ ├── prediction │ ├── engine_prediction.cc │ └── engine_prediction.hh │ ├── rage │ ├── antiaim.cc │ ├── antiaim.hh │ ├── autowall.cc │ ├── autowall.hh │ ├── ragebot.cc │ ├── ragebot.hh │ ├── tickbase.cc │ └── tickbase.hh │ └── visuals │ ├── esp.cc │ ├── esp.hh │ ├── misc.cc │ └── misc.hh ├── lunar_csgo_recode.vcxproj.user ├── main.cc ├── sdk ├── entity.cc ├── entity.hh ├── math │ ├── mathutils.hh │ ├── matrix3x4.hh │ └── vector.hh ├── player.cc ├── player.hh ├── sdk.hh ├── valve │ ├── app_system.hh │ ├── base_client.hh │ ├── class_map.hh │ ├── client_precipitation.hh │ ├── clientstate.hh │ ├── cvar.hh │ ├── debug_overlay.hh │ ├── engine.hh │ ├── engine_trace.hh │ ├── entity_list.hh │ ├── event_listener.hh │ ├── global_vars.hh │ ├── input.hh │ ├── input_system.hh │ ├── material.hh │ ├── model_info.hh │ ├── panel.hh │ ├── prediction.hh │ ├── render_view.hh │ ├── surface.hh │ ├── surface_props.hh │ ├── user_cmd.hh │ ├── valve_vector.hh │ └── view_render_beams.hh ├── weapon.cc └── weapon.hh └── shared ├── color └── color.hh ├── hooking └── hooking.hh └── memory └── memory.hh /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | *.ipch 14 | 15 | # Compiled Dynamic libraries 16 | *.so 17 | *.dylib 18 | *.dll 19 | 20 | # Fortran module files 21 | *.mod 22 | *.smod 23 | 24 | # Compiled Static libraries 25 | *.lai 26 | *.la 27 | *.a 28 | *.lib 29 | 30 | # Executables 31 | *.exe 32 | *.out 33 | *.app 34 | *.dll 35 | *.pdb 36 | 37 | # Misc 38 | *.ilk 39 | *.exp 40 | *.iobj 41 | *.ipdb 42 | *.tlog 43 | *.log 44 | *.idb 45 | *.suo 46 | *.db 47 | *.opendb 48 | *.txt 49 | 50 | # Folders 51 | *.vs 52 | *.vcxproj 53 | *.filters 54 | *binaries 55 | *intermediate 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lunar source leak 2 | 3 | not really proud of this, i started this 1 year and a few months back when i thought spamming namespaces everywhere was good code 4 | 5 | last time this source was actively worked on was like september 2020 and even then, i barely touched it because i burnt myself out on cs altogether, so offsets are probably outdated 6 | some attention depraved dumbasses think it's cool that they have this source even though it has very few worthwhile things in it 7 | 8 | shoutout laxol who was the first one that threatened me with leaking the source back before it was cool, prolex & his buddy aether who started trashtalking me for no reason and claiming they had the source and were going to leak it as well (but didn't as far as i'm aware) and the fuckwad that recently started sending it around the community for some reason (still don't know who that person is) 9 | 10 | the only things that are cool in this source are the menu framework, the rain and the visuals. (maybe some other shit i forgot about too? dunno) 11 | if you're at least somewhat competent, you (probably) don't have anything to learn from this source 12 | -------------------------------------------------------------------------------- /internal_public.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29926.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "internal_public", "lunar_csgo_recode\lunar_csgo_recode.vcxproj", "{5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | debug|csgo = debug|csgo 11 | lunaralphabuild|csgo = lunaralphabuild|csgo 12 | lunardevbuild|csgo = lunardevbuild|csgo 13 | lunarpeasantbuild|csgo = lunarpeasantbuild|csgo 14 | release|csgo = release|csgo 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.debug|csgo.ActiveCfg = debug|Win32 18 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.debug|csgo.Build.0 = debug|Win32 19 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.lunaralphabuild|csgo.ActiveCfg = lunaralphabuild|Win32 20 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.lunaralphabuild|csgo.Build.0 = lunaralphabuild|Win32 21 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.lunardevbuild|csgo.ActiveCfg = lunardevbuild|Win32 22 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.lunardevbuild|csgo.Build.0 = lunardevbuild|Win32 23 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.lunarpeasantbuild|csgo.ActiveCfg = lunarpeasantbuild|Win32 24 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.lunarpeasantbuild|csgo.Build.0 = lunarpeasantbuild|Win32 25 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.release|csgo.ActiveCfg = release|Win32 26 | {5E8589E1-1E0B-4C19-8BE3-325C9E2B7176}.release|csgo.Build.0 = release|Win32 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | GlobalSection(ExtensibilityGlobals) = postSolution 32 | SolutionGuid = {5B928FA4-1974-4654-86B2-02407B06C5B2} 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hasher/hasher.cc: -------------------------------------------------------------------------------- 1 | #include "hasher.hh" -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hasher/hasher.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // ReSharper disable once CppUnusedIncludeDirective 4 | #include 5 | #include 6 | #ifdef RELEASE 7 | #include 8 | #endif 9 | #pragma once 10 | 11 | #define stringify(x) #x 12 | #define concat_impl(x, y) x##y 13 | #define concat(x, y) concat_impl(x, y) 14 | 15 | template 16 | struct constant_holder { 17 | enum class val_holder : t { 18 | val = v 19 | }; 20 | }; 21 | 22 | #define constant(value) ((decltype(value))constant_holder::val_holder::val) 23 | 24 | constexpr uint32_t seed = 0x45C3370D; 25 | constexpr uint32_t prime = 0x1000193; 26 | inline constexpr uint32_t runtime_basis = seed; 27 | 28 | inline uint32_t fnv1a_rt ( const char * key ) { 29 | const char * data = const_cast< char * >( key ); 30 | auto hash = runtime_basis; 31 | 32 | #ifdef RELEASE 33 | hash ^= __readfsdword ( 0x20 ); 34 | #endif 35 | 36 | for ( size_t i = 0; i < strlen ( key ); ++i ) { 37 | const uint8_t value = data [ i ]; 38 | hash = hash ^ value; 39 | hash *= prime; 40 | } 41 | 42 | return hash; 43 | } 44 | 45 | inline uint32_t fnv1a_fl_rt ( const char * key , const uint32_t length ) { 46 | const char * data = const_cast< char * >( key ); 47 | auto hash = runtime_basis; 48 | 49 | #ifdef RELEASE 50 | hash ^= __readfsdword ( 0x20 ); 51 | #endif 52 | 53 | for ( size_t i = 0; i < length; ++i ) { 54 | const auto value = static_cast< uint8_t >( data [ i ] ); 55 | hash = hash ^ value; 56 | hash *= prime; 57 | } 58 | 59 | return hash; 60 | } 61 | 62 | constexpr uint32_t fnv1a_ct ( const char * str , const uint32_t value = seed ) noexcept { 63 | return !*str ? value : fnv1a_ct ( str + 1 , static_cast< unsigned >( 1ull * 64 | ( value ^ static_cast< uint8_t >( *str ) ) * prime ) ); 65 | } 66 | 67 | #define fnv1a(s) constant(fnv1a_ct(s)) -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | // Size of each memory slot. 32 | #if defined(_M_X64) || defined(__x86_64__) 33 | #define MEMORY_SLOT_SIZE 64 34 | #else 35 | #define MEMORY_SLOT_SIZE 32 36 | #endif 37 | 38 | VOID InitializeBuffer ( VOID ); 39 | VOID UninitializeBuffer ( VOID ); 40 | LPVOID AllocateBuffer ( LPVOID pOrigin ); 41 | VOID FreeBuffer ( LPVOID pBuffer ); 42 | BOOL IsExecutableAddress ( LPVOID pAddress ); 43 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/hde/hde32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hacker Disassembler Engine 32 3 | * Copyright (c) 2006-2009, Vyacheslav Patkov. 4 | * All rights reserved. 5 | * 6 | * hde32.h: C/C++ header file 7 | * 8 | */ 9 | 10 | #ifndef _HDE32_H_ 11 | #define _HDE32_H_ 12 | 13 | /* stdint.h - C99 standard header 14 | * http://en.wikipedia.org/wiki/stdint.h 15 | * 16 | * if your compiler doesn't contain "stdint.h" header (for 17 | * example, Microsoft Visual C++), you can download file: 18 | * http://www.azillionmonkeys.com/qed/pstdint.h 19 | * and change next line to: 20 | * #include "pstdint.h" 21 | */ 22 | #include "pstdint.h" 23 | 24 | #define F_MODRM 0x00000001 25 | #define F_SIB 0x00000002 26 | #define F_IMM8 0x00000004 27 | #define F_IMM16 0x00000008 28 | #define F_IMM32 0x00000010 29 | #define F_DISP8 0x00000020 30 | #define F_DISP16 0x00000040 31 | #define F_DISP32 0x00000080 32 | #define F_RELATIVE 0x00000100 33 | #define F_2IMM16 0x00000800 34 | #define F_ERROR 0x00001000 35 | #define F_ERROR_OPCODE 0x00002000 36 | #define F_ERROR_LENGTH 0x00004000 37 | #define F_ERROR_LOCK 0x00008000 38 | #define F_ERROR_OPERAND 0x00010000 39 | #define F_PREFIX_REPNZ 0x01000000 40 | #define F_PREFIX_REPX 0x02000000 41 | #define F_PREFIX_REP 0x03000000 42 | #define F_PREFIX_66 0x04000000 43 | #define F_PREFIX_67 0x08000000 44 | #define F_PREFIX_LOCK 0x10000000 45 | #define F_PREFIX_SEG 0x20000000 46 | #define F_PREFIX_ANY 0x3f000000 47 | 48 | #define PREFIX_SEGMENT_CS 0x2e 49 | #define PREFIX_SEGMENT_SS 0x36 50 | #define PREFIX_SEGMENT_DS 0x3e 51 | #define PREFIX_SEGMENT_ES 0x26 52 | #define PREFIX_SEGMENT_FS 0x64 53 | #define PREFIX_SEGMENT_GS 0x65 54 | #define PREFIX_LOCK 0xf0 55 | #define PREFIX_REPNZ 0xf2 56 | #define PREFIX_REPX 0xf3 57 | #define PREFIX_OPERAND_SIZE 0x66 58 | #define PREFIX_ADDRESS_SIZE 0x67 59 | 60 | #pragma pack(push,1) 61 | 62 | typedef struct { 63 | uint8_t len; 64 | uint8_t p_rep; 65 | uint8_t p_lock; 66 | uint8_t p_seg; 67 | uint8_t p_66; 68 | uint8_t p_67; 69 | uint8_t opcode; 70 | uint8_t opcode2; 71 | uint8_t modrm; 72 | uint8_t modrm_mod; 73 | uint8_t modrm_reg; 74 | uint8_t modrm_rm; 75 | uint8_t sib; 76 | uint8_t sib_scale; 77 | uint8_t sib_index; 78 | uint8_t sib_base; 79 | union { 80 | uint8_t imm8; 81 | uint16_t imm16; 82 | uint32_t imm32; 83 | } imm; 84 | union { 85 | uint8_t disp8; 86 | uint16_t disp16; 87 | uint32_t disp32; 88 | } disp; 89 | uint32_t flags; 90 | } hde32s; 91 | 92 | #pragma pack(pop) 93 | 94 | #ifdef __cplusplus 95 | extern "C" { 96 | #endif 97 | 98 | /* __cdecl */ 99 | unsigned int hde32_disasm ( const void * code , hde32s * hs ); 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif /* _HDE32_H_ */ 106 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/hde/hde64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hacker Disassembler Engine 64 3 | * Copyright (c) 2008-2009, Vyacheslav Patkov. 4 | * All rights reserved. 5 | * 6 | * hde64.h: C/C++ header file 7 | * 8 | */ 9 | 10 | #ifndef _HDE64_H_ 11 | #define _HDE64_H_ 12 | 13 | /* stdint.h - C99 standard header 14 | * http://en.wikipedia.org/wiki/stdint.h 15 | * 16 | * if your compiler doesn't contain "stdint.h" header (for 17 | * example, Microsoft Visual C++), you can download file: 18 | * http://www.azillionmonkeys.com/qed/pstdint.h 19 | * and change next line to: 20 | * #include "pstdint.h" 21 | */ 22 | #include "pstdint.h" 23 | 24 | #define F_MODRM 0x00000001 25 | #define F_SIB 0x00000002 26 | #define F_IMM8 0x00000004 27 | #define F_IMM16 0x00000008 28 | #define F_IMM32 0x00000010 29 | #define F_IMM64 0x00000020 30 | #define F_DISP8 0x00000040 31 | #define F_DISP16 0x00000080 32 | #define F_DISP32 0x00000100 33 | #define F_RELATIVE 0x00000200 34 | #define F_ERROR 0x00001000 35 | #define F_ERROR_OPCODE 0x00002000 36 | #define F_ERROR_LENGTH 0x00004000 37 | #define F_ERROR_LOCK 0x00008000 38 | #define F_ERROR_OPERAND 0x00010000 39 | #define F_PREFIX_REPNZ 0x01000000 40 | #define F_PREFIX_REPX 0x02000000 41 | #define F_PREFIX_REP 0x03000000 42 | #define F_PREFIX_66 0x04000000 43 | #define F_PREFIX_67 0x08000000 44 | #define F_PREFIX_LOCK 0x10000000 45 | #define F_PREFIX_SEG 0x20000000 46 | #define F_PREFIX_REX 0x40000000 47 | #define F_PREFIX_ANY 0x7f000000 48 | 49 | #define PREFIX_SEGMENT_CS 0x2e 50 | #define PREFIX_SEGMENT_SS 0x36 51 | #define PREFIX_SEGMENT_DS 0x3e 52 | #define PREFIX_SEGMENT_ES 0x26 53 | #define PREFIX_SEGMENT_FS 0x64 54 | #define PREFIX_SEGMENT_GS 0x65 55 | #define PREFIX_LOCK 0xf0 56 | #define PREFIX_REPNZ 0xf2 57 | #define PREFIX_REPX 0xf3 58 | #define PREFIX_OPERAND_SIZE 0x66 59 | #define PREFIX_ADDRESS_SIZE 0x67 60 | 61 | #pragma pack(push,1) 62 | 63 | typedef struct { 64 | uint8_t len; 65 | uint8_t p_rep; 66 | uint8_t p_lock; 67 | uint8_t p_seg; 68 | uint8_t p_66; 69 | uint8_t p_67; 70 | uint8_t rex; 71 | uint8_t rex_w; 72 | uint8_t rex_r; 73 | uint8_t rex_x; 74 | uint8_t rex_b; 75 | uint8_t opcode; 76 | uint8_t opcode2; 77 | uint8_t modrm; 78 | uint8_t modrm_mod; 79 | uint8_t modrm_reg; 80 | uint8_t modrm_rm; 81 | uint8_t sib; 82 | uint8_t sib_scale; 83 | uint8_t sib_index; 84 | uint8_t sib_base; 85 | union { 86 | uint8_t imm8; 87 | uint16_t imm16; 88 | uint32_t imm32; 89 | uint64_t imm64; 90 | } imm; 91 | union { 92 | uint8_t disp8; 93 | uint16_t disp16; 94 | uint32_t disp32; 95 | } disp; 96 | uint32_t flags; 97 | } hde64s; 98 | 99 | #pragma pack(pop) 100 | 101 | #ifdef __cplusplus 102 | extern "C" { 103 | #endif 104 | 105 | /* __cdecl */ 106 | unsigned int hde64_disasm ( const void * code , hde64s * hs ); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif /* _HDE64_H_ */ 113 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/hde/pstdint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | // Integer types for HDE. 32 | typedef INT8 int8_t; 33 | typedef INT16 int16_t; 34 | typedef INT32 int32_t; 35 | typedef INT64 int64_t; 36 | typedef UINT8 uint8_t; 37 | typedef UINT16 uint16_t; 38 | typedef UINT32 uint32_t; 39 | typedef UINT64 uint64_t; 40 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/hde/table32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hacker Disassembler Engine 32 C 3 | * Copyright (c) 2008-2009, Vyacheslav Patkov. 4 | * All rights reserved. 5 | * 6 | */ 7 | 8 | #define C_NONE 0x00 9 | #define C_MODRM 0x01 10 | #define C_IMM8 0x02 11 | #define C_IMM16 0x04 12 | #define C_IMM_P66 0x10 13 | #define C_REL8 0x20 14 | #define C_REL32 0x40 15 | #define C_GROUP 0x80 16 | #define C_ERROR 0xff 17 | 18 | #define PRE_ANY 0x00 19 | #define PRE_NONE 0x01 20 | #define PRE_F2 0x02 21 | #define PRE_F3 0x04 22 | #define PRE_66 0x08 23 | #define PRE_67 0x10 24 | #define PRE_LOCK 0x20 25 | #define PRE_SEG 0x40 26 | #define PRE_ALL 0xff 27 | 28 | #define DELTA_OPCODES 0x4a 29 | #define DELTA_FPU_REG 0xf1 30 | #define DELTA_FPU_MODRM 0xf8 31 | #define DELTA_PREFIXES 0x130 32 | #define DELTA_OP_LOCK_OK 0x1a1 33 | #define DELTA_OP2_LOCK_OK 0x1b9 34 | #define DELTA_OP_ONLY_MEM 0x1cb 35 | #define DELTA_OP2_ONLY_MEM 0x1da 36 | 37 | unsigned char hde32_table [ ] = { 38 | 0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3, 39 | 0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xac,0xaa,0xb2,0xaa,0x9f,0x9f, 40 | 0x9f,0x9f,0xb5,0xa3,0xa3,0xa4,0xaa,0xaa,0xba,0xaa,0x96,0xaa,0xa8,0xaa,0xc3, 41 | 0xc3,0x96,0x96,0xb7,0xae,0xd6,0xbd,0xa3,0xc5,0xa3,0xa3,0x9f,0xc3,0x9c,0xaa, 42 | 0xaa,0xac,0xaa,0xbf,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0x90, 43 | 0x82,0x7d,0x97,0x59,0x59,0x59,0x59,0x59,0x7f,0x59,0x59,0x60,0x7d,0x7f,0x7f, 44 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x9a,0x88,0x7d, 45 | 0x59,0x50,0x50,0x50,0x50,0x59,0x59,0x59,0x59,0x61,0x94,0x61,0x9e,0x59,0x59, 46 | 0x85,0x59,0x92,0xa3,0x60,0x60,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59, 47 | 0x59,0x59,0x9f,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xcc,0x01,0xbc,0x03,0xf0, 48 | 0x10,0x10,0x10,0x10,0x50,0x50,0x50,0x50,0x14,0x20,0x20,0x20,0x20,0x01,0x01, 49 | 0x01,0x01,0xc4,0x02,0x10,0x00,0x00,0x00,0x00,0x01,0x01,0xc0,0xc2,0x10,0x11, 50 | 0x02,0x03,0x11,0x03,0x03,0x04,0x00,0x00,0x14,0x00,0x02,0x00,0x00,0xc6,0xc8, 51 | 0x02,0x02,0x02,0x02,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xca, 52 | 0x01,0x01,0x01,0x00,0x06,0x00,0x04,0x00,0xc0,0xc2,0x01,0x01,0x03,0x01,0xff, 53 | 0xff,0x01,0x00,0x03,0xc4,0xc4,0xc6,0x03,0x01,0x01,0x01,0xff,0x03,0x03,0x03, 54 | 0xc8,0x40,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00, 55 | 0x00,0x00,0x00,0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00, 56 | 0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 57 | 0x00,0xff,0xff,0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 58 | 0x7f,0x00,0x00,0xff,0x4a,0x4a,0x4a,0x4a,0x4b,0x52,0x4a,0x4a,0x4a,0x4a,0x4f, 59 | 0x4c,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x55,0x45,0x40,0x4a,0x4a,0x4a, 60 | 0x45,0x59,0x4d,0x46,0x4a,0x5d,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a, 61 | 0x4a,0x4a,0x4a,0x4a,0x4a,0x61,0x63,0x67,0x4e,0x4a,0x4a,0x6b,0x6d,0x4a,0x4a, 62 | 0x45,0x6d,0x4a,0x4a,0x44,0x45,0x4a,0x4a,0x00,0x00,0x00,0x02,0x0d,0x06,0x06, 63 | 0x06,0x06,0x0e,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x06,0x06,0x02,0x06, 64 | 0x00,0x0a,0x0a,0x07,0x07,0x06,0x02,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04, 65 | 0x04,0x04,0x00,0x00,0x00,0x0e,0x05,0x06,0x06,0x06,0x01,0x06,0x00,0x00,0x08, 66 | 0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01, 67 | 0x86,0x00,0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba, 68 | 0xf8,0xbb,0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00, 69 | 0xc4,0xff,0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00, 70 | 0x13,0x09,0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07, 71 | 0xb2,0xff,0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf, 72 | 0xe7,0x08,0x00,0xf0,0x02,0x00 73 | }; 74 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/hde/table64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hacker Disassembler Engine 64 C 3 | * Copyright (c) 2008-2009, Vyacheslav Patkov. 4 | * All rights reserved. 5 | * 6 | */ 7 | 8 | #define C_NONE 0x00 9 | #define C_MODRM 0x01 10 | #define C_IMM8 0x02 11 | #define C_IMM16 0x04 12 | #define C_IMM_P66 0x10 13 | #define C_REL8 0x20 14 | #define C_REL32 0x40 15 | #define C_GROUP 0x80 16 | #define C_ERROR 0xff 17 | 18 | #define PRE_ANY 0x00 19 | #define PRE_NONE 0x01 20 | #define PRE_F2 0x02 21 | #define PRE_F3 0x04 22 | #define PRE_66 0x08 23 | #define PRE_67 0x10 24 | #define PRE_LOCK 0x20 25 | #define PRE_SEG 0x40 26 | #define PRE_ALL 0xff 27 | 28 | #define DELTA_OPCODES 0x4a 29 | #define DELTA_FPU_REG 0xfd 30 | #define DELTA_FPU_MODRM 0x104 31 | #define DELTA_PREFIXES 0x13c 32 | #define DELTA_OP_LOCK_OK 0x1ae 33 | #define DELTA_OP2_LOCK_OK 0x1c6 34 | #define DELTA_OP_ONLY_MEM 0x1d8 35 | #define DELTA_OP2_ONLY_MEM 0x1e7 36 | 37 | unsigned char hde64_table [ ] = { 38 | 0xa5,0xaa,0xa5,0xb8,0xa5,0xaa,0xa5,0xaa,0xa5,0xb8,0xa5,0xb8,0xa5,0xb8,0xa5, 39 | 0xb8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xac,0xc0,0xcc,0xc0,0xa1,0xa1, 40 | 0xa1,0xa1,0xb1,0xa5,0xa5,0xa6,0xc0,0xc0,0xd7,0xda,0xe0,0xc0,0xe4,0xc0,0xea, 41 | 0xea,0xe0,0xe0,0x98,0xc8,0xee,0xf1,0xa5,0xd3,0xa5,0xa5,0xa1,0xea,0x9e,0xc0, 42 | 0xc0,0xc2,0xc0,0xe6,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0xab, 43 | 0x8b,0x90,0x64,0x5b,0x5b,0x5b,0x5b,0x5b,0x92,0x5b,0x5b,0x76,0x90,0x92,0x92, 44 | 0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x6a,0x73,0x90, 45 | 0x5b,0x52,0x52,0x52,0x52,0x5b,0x5b,0x5b,0x5b,0x77,0x7c,0x77,0x85,0x5b,0x5b, 46 | 0x70,0x5b,0x7a,0xaf,0x76,0x76,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b, 47 | 0x5b,0x5b,0x86,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xd5,0x03,0xcc,0x01,0xbc, 48 | 0x03,0xf0,0x03,0x03,0x04,0x00,0x50,0x50,0x50,0x50,0xff,0x20,0x20,0x20,0x20, 49 | 0x01,0x01,0x01,0x01,0xc4,0x02,0x10,0xff,0xff,0xff,0x01,0x00,0x03,0x11,0xff, 50 | 0x03,0xc4,0xc6,0xc8,0x02,0x10,0x00,0xff,0xcc,0x01,0x01,0x01,0x00,0x00,0x00, 51 | 0x00,0x01,0x01,0x03,0x01,0xff,0xff,0xc0,0xc2,0x10,0x11,0x02,0x03,0x01,0x01, 52 | 0x01,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x10, 53 | 0x10,0x10,0x10,0x02,0x10,0x00,0x00,0xc6,0xc8,0x02,0x02,0x02,0x02,0x06,0x00, 54 | 0x04,0x00,0x02,0xff,0x00,0xc0,0xc2,0x01,0x01,0x03,0x03,0x03,0xca,0x40,0x00, 55 | 0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,0x00,0x00,0x00, 56 | 0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0xff,0x00, 57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff, 58 | 0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00, 59 | 0xff,0x40,0x40,0x40,0x40,0x41,0x49,0x40,0x40,0x40,0x40,0x4c,0x42,0x40,0x40, 60 | 0x40,0x40,0x40,0x40,0x40,0x40,0x4f,0x44,0x53,0x40,0x40,0x40,0x44,0x57,0x43, 61 | 0x5c,0x40,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 62 | 0x40,0x40,0x64,0x66,0x6e,0x6b,0x40,0x40,0x6a,0x46,0x40,0x40,0x44,0x46,0x40, 63 | 0x40,0x5b,0x44,0x40,0x40,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x01,0x06, 64 | 0x06,0x02,0x06,0x06,0x00,0x06,0x00,0x0a,0x0a,0x00,0x00,0x00,0x02,0x07,0x07, 65 | 0x06,0x02,0x0d,0x06,0x06,0x06,0x0e,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04, 66 | 0x04,0x04,0x05,0x06,0x06,0x06,0x00,0x00,0x00,0x0e,0x00,0x00,0x08,0x00,0x10, 67 | 0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,0x86,0x00, 68 | 0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,0xf8,0xbb, 69 | 0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,0xc4,0xff, 70 | 0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,0x13,0x09, 71 | 0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,0xb2,0xff, 72 | 0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,0xe7,0x08, 73 | 0x00,0xf0,0x02,0x00 74 | }; 75 | -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/minhook.hh: -------------------------------------------------------------------------------- 1 | /* swoopae's minhook fork */ 2 | 3 | #pragma once 4 | 5 | #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) 6 | #error MinHook supports only x86 and x64 systems. 7 | #endif 8 | 9 | #include 10 | 11 | // MinHook Error Codes. 12 | typedef enum MH_STATUS { 13 | // Unknown error. Should not be returned. 14 | MH_UNKNOWN = -1 , 15 | 16 | // Successful. 17 | MH_OK = 0 , 18 | 19 | // MinHook is already initialized. 20 | MH_ERROR_ALREADY_INITIALIZED , 21 | 22 | // MinHook is not initialized yet, or already uninitialized. 23 | MH_ERROR_NOT_INITIALIZED , 24 | 25 | // The hook for the specified target function is already created. 26 | MH_ERROR_ALREADY_CREATED , 27 | 28 | // The hook for the specified target function is not created yet. 29 | MH_ERROR_NOT_CREATED , 30 | 31 | // The hook for the specified target function is already enabled. 32 | MH_ERROR_ENABLED , 33 | 34 | // The hook for the specified target function is not enabled yet, or already 35 | // disabled. 36 | MH_ERROR_DISABLED , 37 | 38 | // The specified pointer is invalid. It points the address of non-allocated 39 | // and/or non-executable region. 40 | MH_ERROR_NOT_EXECUTABLE , 41 | 42 | // The specified target function cannot be hooked. 43 | MH_ERROR_UNSUPPORTED_FUNCTION , 44 | 45 | // Failed to allocate memory. 46 | MH_ERROR_MEMORY_ALLOC , 47 | 48 | // Failed to change the memory protection. 49 | MH_ERROR_MEMORY_PROTECT , 50 | 51 | // The specified module is not loaded. 52 | MH_ERROR_MODULE_NOT_FOUND , 53 | 54 | // The specified function is not found. 55 | MH_ERROR_FUNCTION_NOT_FOUND 56 | } 57 | MH_STATUS; 58 | 59 | // Can be passed as a parameter to MH_EnableHook, MH_DisableHook, 60 | // MH_QueueEnableHook or MH_QueueDisableHook. 61 | #define MH_ALL_HOOKS NULL 62 | 63 | #ifdef __cplusplus 64 | extern "C" { 65 | #endif 66 | 67 | // Initialize the MinHook library. You must call this function EXACTLY ONCE 68 | // at the beginning of your program. 69 | MH_STATUS WINAPI MH_Initialize ( VOID ); 70 | 71 | // Uninitialize the MinHook library. You must call this function EXACTLY 72 | // ONCE at the end of your program. 73 | MH_STATUS WINAPI MH_Uninitialize ( VOID ); 74 | 75 | // Creates a Hook for the specified target function, in disabled state. 76 | // Parameters: 77 | // pTarget [in] A pointer to the target function, which will be 78 | // overridden by the detour function. 79 | // pDetour [in] A pointer to the detour function, which will override 80 | // the target function. 81 | // ppOriginal [out] A pointer to the trampoline function, which will be 82 | // used to call the original target function. 83 | // This parameter can be NULL. 84 | MH_STATUS WINAPI MH_CreateHook ( LPVOID pTarget , LPVOID pDetour , LPVOID * ppOriginal ); 85 | 86 | // Creates a Hook for the specified API function, in disabled state. 87 | // Parameters: 88 | // pszModule [in] A pointer to the loaded module name which contains the 89 | // target function. 90 | // pszTarget [in] A pointer to the target function name, which will be 91 | // overridden by the detour function. 92 | // pDetour [in] A pointer to the detour function, which will override 93 | // the target function. 94 | // ppOriginal [out] A pointer to the trampoline function, which will be 95 | // used to call the original target function. 96 | // This parameter can be NULL. 97 | MH_STATUS WINAPI MH_CreateHookApi ( 98 | LPCWSTR pszModule , LPCSTR pszProcName , LPVOID pDetour , LPVOID * ppOriginal ); 99 | 100 | // Creates a Hook for the specified API function, in disabled state. 101 | // Parameters: 102 | // pszModule [in] A pointer to the loaded module name which contains the 103 | // target function. 104 | // pszTarget [in] A pointer to the target function name, which will be 105 | // overridden by the detour function. 106 | // pDetour [in] A pointer to the detour function, which will override 107 | // the target function. 108 | // ppOriginal [out] A pointer to the trampoline function, which will be 109 | // used to call the original target function. 110 | // This parameter can be NULL. 111 | // ppTarget [out] A pointer to the target function, which will be used 112 | // with other functions. 113 | // This parameter can be NULL. 114 | MH_STATUS WINAPI MH_CreateHookApiEx ( 115 | LPCWSTR pszModule , LPCSTR pszProcName , LPVOID pDetour , LPVOID * ppOriginal , LPVOID * ppTarget ); 116 | 117 | // Removes an already created hook. 118 | // Parameters: 119 | // pTarget [in] A pointer to the target function. 120 | MH_STATUS WINAPI MH_RemoveHook ( LPVOID pTarget ); 121 | 122 | // Enables an already created hook. 123 | // Parameters: 124 | // pTarget [in] A pointer to the target function. 125 | // If this parameter is MH_ALL_HOOKS, all created hooks are 126 | // enabled in one go. 127 | MH_STATUS WINAPI MH_EnableHook ( LPVOID pTarget ); 128 | 129 | // Disables an already created hook. 130 | // Parameters: 131 | // pTarget [in] A pointer to the target function. 132 | // If this parameter is MH_ALL_HOOKS, all created hooks are 133 | // disabled in one go. 134 | MH_STATUS WINAPI MH_DisableHook ( LPVOID pTarget ); 135 | 136 | // Queues to enable an already created hook. 137 | // Parameters: 138 | // pTarget [in] A pointer to the target function. 139 | // If this parameter is MH_ALL_HOOKS, all created hooks are 140 | // queued to be enabled. 141 | MH_STATUS WINAPI MH_QueueEnableHook ( LPVOID pTarget ); 142 | 143 | // Queues to disable an already created hook. 144 | // Parameters: 145 | // pTarget [in] A pointer to the target function. 146 | // If this parameter is MH_ALL_HOOKS, all created hooks are 147 | // queued to be disabled. 148 | MH_STATUS WINAPI MH_QueueDisableHook ( LPVOID pTarget ); 149 | 150 | // Applies all queued changes in one go. 151 | MH_STATUS WINAPI MH_ApplyQueued ( VOID ); 152 | 153 | // Translates the MH_STATUS to its name as a string. 154 | const char * WINAPI MH_StatusToString ( MH_STATUS status ); 155 | 156 | #ifdef __cplusplus 157 | } 158 | #endif 159 | 160 | /* we mostly use minhook but some functions require vmt hooking or they act weird... */ 161 | #define create_detour_hook MH_CreateHook 162 | #define enable_detour_hook MH_EnableHook 163 | #define remove_detour_hook MH_RemoveHook 164 | #define init_minhook MH_Initialize 165 | #define uninit_minhook MH_Uninitialize -------------------------------------------------------------------------------- /lunar_csgo_recode/external/hooking/trampoline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | #pragma pack(push, 1) 32 | 33 | // Structs for writing x86/x64 instructions. 34 | 35 | // 8-bit relative jump. 36 | typedef struct _JMP_REL_SHORT { 37 | UINT8 opcode; // EB xx: JMP +2+xx 38 | UINT8 operand; 39 | } JMP_REL_SHORT , * PJMP_REL_SHORT; 40 | 41 | // 32-bit direct relative jump/call. 42 | typedef struct _JMP_REL { 43 | UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx 44 | UINT32 operand; // Relative destination address 45 | } JMP_REL , * PJMP_REL , CALL_REL; 46 | 47 | // 64-bit indirect absolute jump. 48 | typedef struct _JMP_ABS { 49 | UINT8 opcode0; // FF25 00000000: JMP [+6] 50 | UINT8 opcode1; 51 | UINT32 dummy; 52 | UINT64 address; // Absolute destination address 53 | } JMP_ABS , * PJMP_ABS; 54 | 55 | // 64-bit indirect absolute call. 56 | typedef struct _CALL_ABS { 57 | UINT8 opcode0; // FF15 00000002: CALL [+6] 58 | UINT8 opcode1; 59 | UINT32 dummy0; 60 | UINT8 dummy1; // EB 08: JMP +10 61 | UINT8 dummy2; 62 | UINT64 address; // Absolute destination address 63 | } CALL_ABS; 64 | 65 | // 32-bit direct relative conditional jumps. 66 | typedef struct _JCC_REL { 67 | UINT8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx 68 | UINT8 opcode1; 69 | UINT32 operand; // Relative destination address 70 | } JCC_REL; 71 | 72 | // 64bit indirect absolute conditional jumps that x64 lacks. 73 | typedef struct _JCC_ABS { 74 | UINT8 opcode; // 7* 0E: J** +16 75 | UINT8 dummy0; 76 | UINT8 dummy1; // FF25 00000000: JMP [+6] 77 | UINT8 dummy2; 78 | UINT32 dummy3; 79 | UINT64 address; // Absolute destination address 80 | } JCC_ABS; 81 | 82 | #pragma pack(pop) 83 | 84 | typedef struct _TRAMPOLINE { 85 | LPVOID pTarget; // [In] Address of the target function. 86 | LPVOID pDetour; // [In] Address of the detour function. 87 | LPVOID pTrampoline; // [In] Buffer address for the trampoline and relay function. 88 | 89 | #if defined(_M_X64) || defined(__x86_64__) 90 | LPVOID pRelay; // [Out] Address of the relay function. 91 | #endif 92 | BOOL patchAbove; // [Out] Should use the hot patch area? 93 | UINT nIP; // [Out] Number of the instruction boundaries. 94 | UINT8 oldIPs [ 8 ]; // [Out] Instruction boundaries of the target function. 95 | UINT8 newIPs [ 8 ]; // [Out] Instruction boundaries of the trampoline function. 96 | } TRAMPOLINE , * PTRAMPOLINE; 97 | 98 | BOOL CreateTrampolineFunction ( PTRAMPOLINE ct ); 99 | -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/game/globals.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "interfaces.hh" 6 | 7 | namespace hack::game::globals { 8 | inline HMODULE this_instance; 9 | inline bool should_uninject = false , send_packet = true; 10 | inline sdk::valve::ucmd_t * cmd = nullptr; 11 | inline sdk::c_player * local = nullptr; 12 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/game/modules.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../../external/hasher/hasher.hh" 8 | #include "../../external/xor/xor.hh" 9 | 10 | /* game module name macros */ 11 | #define MODULE_CLIENT_PANORAMA 0 12 | #define MODULE_ENGINE 1 13 | #define MODULE_INPUT_SYSTEM 2 14 | #define MODULE_VGUI 3 15 | #define MODULE_GAME_OVERLAY_RENDERER 4 16 | #define MODULE_TIER0 5 17 | #define MODULE_VSTDLIB 6 18 | #define MODULE_VPHYSICS 7 19 | #define MODULE_MATERIAL_SYSTEM 8 20 | #define MODULE_VGUI_MAT_SURFACE 9 21 | #define MODULE_SHADER_API_DX9 10 22 | #define MODULE_SERVER 11 23 | #define MODULE_DATACACHE 12 24 | 25 | /* find the address */ 26 | #define GRAB_MODULE( x ) hack::game::modules::game_modules.find ( x )._Ptr->_Myval.second 27 | 28 | /* game modules */ 29 | namespace hack::game::modules { 30 | inline std::unordered_map game_modules; 31 | 32 | static bool emplace_module ( std::string_view module_name , std::uint32_t module_index ) { 33 | const auto module_addy = reinterpret_cast< std::uintptr_t >( GetModuleHandleA ( module_name.data ( ) ) ); 34 | 35 | if ( !module_addy ) 36 | return false; 37 | 38 | game_modules.emplace ( module_index , module_addy ); 39 | 40 | return true; 41 | } 42 | 43 | static bool grab_modules ( ) { 44 | #if defined(_DEBUG) || defined(LUNAR_DEV) 45 | std::cout << "[info] - grabbing all module addresses...\n"; 46 | #endif 47 | 48 | /* lol wtf was i thinking lmaooooo -swoopae from the future */ 49 | if ( !emplace_module ( STR ( "client.dll" ) , MODULE_CLIENT_PANORAMA ) ) 50 | return false; 51 | 52 | if ( !emplace_module ( STR ( "engine.dll" ) , MODULE_ENGINE ) ) 53 | return false; 54 | 55 | if ( !emplace_module ( STR ( "inputsystem.dll" ) , MODULE_INPUT_SYSTEM ) ) 56 | return false; 57 | 58 | if ( !emplace_module ( STR ( "vgui2.dll" ) , MODULE_VGUI ) ) 59 | return false; 60 | 61 | if ( !emplace_module ( STR ( "GameOverlayRenderer.dll" ) , MODULE_GAME_OVERLAY_RENDERER ) ) 62 | return false; 63 | 64 | if ( !emplace_module ( STR ( "tier0.dll" ) , MODULE_TIER0 ) ) 65 | return false; 66 | 67 | if ( !emplace_module ( STR ( "vstdlib.dll" ) , MODULE_VSTDLIB ) ) 68 | return false; 69 | 70 | if ( !emplace_module ( STR ( "vphysics.dll" ) , MODULE_VPHYSICS ) ) 71 | return false; 72 | 73 | if ( !emplace_module ( STR ( "materialsystem.dll" ) , MODULE_MATERIAL_SYSTEM ) ) 74 | return false; 75 | 76 | if ( !emplace_module ( STR ( "vguimatsurface.dll" ) , MODULE_VGUI_MAT_SURFACE ) ) 77 | return false; 78 | 79 | if ( !emplace_module ( STR ( "shaderapidx9.dll" ) , MODULE_SHADER_API_DX9 ) ) 80 | return false; 81 | 82 | if ( !emplace_module ( STR ( "server.dll" ) , MODULE_SERVER ) ) 83 | return false; 84 | 85 | if ( !emplace_module ( STR ( "datacache.dll" ) , MODULE_DATACACHE ) ) 86 | return false; 87 | 88 | #if defined(_DEBUG) || defined(LUNAR_DEV) 89 | std::cout << "[info] - grabbed all module addresses\n"; 90 | #endif 91 | return true; 92 | } 93 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/game/netvars.cc: -------------------------------------------------------------------------------- 1 | #include "netvars.hh" 2 | #include "interfaces.hh" 3 | #include "globals.hh" 4 | 5 | bool hack::game::netvars::grab_netvars ( ) { 6 | #if defined(_DEBUG) || defined(LUNAR_DEV) 7 | std::cout << "[info] - dumping all netvars recursively...\n"; 8 | ofs << "fartcheat name - csgo netvar dump - compile date: " << __DATE__ << '\n'; 9 | #endif 10 | for ( auto pclass = hack::game::interfaces::client->get_all_classes ( ); pclass; pclass = pclass->m_next ) { 11 | // if ( pclass->m_class_id == sdk::valve::class_id::cprecipitation ) 12 | // hack::game::globals::precipitation_client_class = pclass; 13 | 14 | const auto table = pclass->m_recv_table; 15 | 16 | if ( !table ) 17 | continue; 18 | 19 | dump_rec ( table ); 20 | } 21 | 22 | #if defined(_DEBUG) || defined(LUNAR_DEV) 23 | std::cout << "[info] - dumped all netvars\n"; 24 | #endif 25 | 26 | return true; 27 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/game/netvars.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../sdk/valve/base_client.hh" 4 | #include "../../external/xor/xor.hh" 5 | #include "../../external/hasher/hasher.hh" 6 | 7 | #include 8 | #include 9 | 10 | #define netvar_offset( t, func, name, off ) \ 11 | t& func( ) { \ 12 | static const auto offset = hack::game::netvars::offsets[ fnv1a ( name ) ]; \ 13 | return *( t* ) ( std::uintptr_t( this ) + offset + off ); \ 14 | } 15 | 16 | #define netvar_fn( t, func, name ) \ 17 | t& func( ) { \ 18 | static const auto offset = hack::game::netvars::offsets[ fnv1a ( name ) ]; \ 19 | return *( t* ) ( std::uintptr_t( this ) + offset ); \ 20 | } 21 | 22 | #define offset( t, func, offset ) \ 23 | t& func( ) { \ 24 | return *( t* ) ( std::uintptr_t( this ) + offset ); \ 25 | } 26 | 27 | #define poffset( t, func, offset ) \ 28 | t func( ) { \ 29 | return ( t ) ( std::uintptr_t( this ) + offset ); \ 30 | } 31 | 32 | #define foffset( type, ptr, offset ) \ 33 | ( *( type* ) ( ( std::uintptr_t ) (ptr) + ( offset ) ) ) 34 | 35 | namespace hack::game::netvars { 36 | #if defined(_DEBUG) || defined(LUNAR_DEV) 37 | inline std::ofstream ofs ( "netvars.dump" ); 38 | #endif 39 | inline std::unordered_map< std::uint32_t , std::uintptr_t > offsets; 40 | 41 | static void dump_rec ( sdk::valve::recv_table_t * table ) { 42 | for ( auto i = 0; i < table->m_prop_count; ++i ) { 43 | const auto prop = &table->m_props [ i ]; 44 | 45 | if ( !prop 46 | || std::isdigit ( prop->m_name [ 0 ] ) 47 | || !std::strcmp ( prop->m_name , STR ( "baseclass" ) ) ) 48 | continue; 49 | 50 | if ( prop->m_recv_type == 6 51 | && prop->m_table 52 | && prop->m_table->m_net_table_name [ 0 ] == 'D' ) 53 | dump_rec ( prop->m_table ); 54 | 55 | #if defined(_DEBUG) || defined(LUNAR_DEV) 56 | ofs << table->m_net_table_name + std::string ( "->" ) + prop->m_name << "=" << prop->m_offset << " - hash: " << fnv1a_rt ( std::string ( table->m_net_table_name + std::string ( "->" ) + prop->m_name ).data ( ) ) << '\n'; 57 | #endif 58 | 59 | offsets [ fnv1a_rt ( std::string ( table->m_net_table_name + std::string ( "->" ) + prop->m_name ).data ( ) ) ] = prop->m_offset; 60 | } 61 | } 62 | 63 | bool grab_netvars ( ); 64 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/buildtransofrmations.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/animations/animations.hh" 4 | 5 | void __fastcall hack::hooks::buildtransformations_hk ( x86reg , int a2 , c_vector3 * a3 , c_quaternion * a4 , int a5 , int a6 , int a7 ) { 6 | /* sanity check */ 7 | if ( !ecx ) 8 | return originals::o_buildtransformations ( x86regout , a2 , a3 , a4 , a5 , a6 , a7 ); 9 | 10 | const auto entity = reinterpret_cast< sdk::c_player * >( ecx ); 11 | 12 | /* player check */ 13 | if ( entity->index ( ) > 64 ) 14 | return originals::o_buildtransformations ( x86regout , a2 , a3 , a4 , a5 , a6 , a7 ); 15 | 16 | /* force jiggle bones off */ 17 | const auto backup_jiggle = *( std::uint32_t * ) ( ( std::uintptr_t ) entity + 0x292C ); 18 | *( std::uint32_t * ) ( ( std::uintptr_t ) entity + 0x292C ) = 0; 19 | 20 | /* call original */ 21 | originals::o_buildtransformations ( x86regout , a2 , a3 , a4 , a5 , a6 , a7 ); 22 | 23 | /* restore jiggle bones */ 24 | *( std::uint32_t * ) ( ( std::uintptr_t ) entity + 0x292C ) = backup_jiggle; 25 | 26 | if ( entity == hack::game::globals::local ) { 27 | hack::modules::animations::local_bones_pos = a3; 28 | hack::modules::animations::local_bones_quat = a4; 29 | } 30 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/calcviewbob.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | void __fastcall hack::hooks::calcviewbob_hk ( x86reg , c_vector3 & eye_origin ) { 4 | return; 5 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/clmove.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | #include "../../modules/rage/tickbase.hh" 5 | #include "../../menu/config.hh" 6 | 7 | void __cdecl hack::hooks::clmove_hk ( float samples , bool final_tick ) { 8 | /* sanity checks */ 9 | if ( !hack::game::interfaces::engine->is_connected ( ) || !hack::game::interfaces::engine->is_in_game ( ) ) 10 | return originals::o_clmove ( samples , final_tick ); 11 | 12 | if ( !hack::game::globals::local || !hack::game::globals::cmd ) 13 | return originals::o_clmove ( samples , final_tick ); 14 | 15 | const auto & r_tickbasemanip = CONFIG_GET ( bool , fnv1a ( "r_tickbasemanip" ) ); 16 | 17 | /* if shifting do shit */ 18 | if ( hack::modules::rage::tickbase::in_clmove ( ) ) 19 | return; 20 | 21 | originals::o_clmove ( samples , final_tick ); 22 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/createentity.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | 5 | // idk what i was trying to do here lol -swoopae from future 6 | void * __fastcall hack::hooks::createentity_hk ( x86reg , const char * mapname ) { 7 | if ( !hack::game::interfaces::class_map ) 8 | return originals::o_createentity ( x86regout , mapname ); 9 | 10 | hack::game::interfaces::class_map = reinterpret_cast< sdk::valve::c_classmap* >( ecx ); 11 | 12 | return originals::o_createentity ( x86regout , mapname ); 13 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/createmove.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | #include "../../menu/config.hh" 5 | 6 | #include "../../modules/prediction/engine_prediction.hh" 7 | #include "../../modules/rage/tickbase.hh" 8 | #include "../../modules/rage/antiaim.hh" 9 | #include "../../modules/animations/animations.hh" 10 | #include "../../modules/misc/movement.hh" 11 | #include "../../modules/misc/others.hh" 12 | 13 | #include 14 | 15 | bool __fastcall hack::hooks::createmove_hk ( x86reg , float sampletime , sdk::valve::ucmd_t * cmd ) { 16 | /* sanity checks */ 17 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) ) { 18 | /* panic and clean up */ 19 | hack::game::globals::local = nullptr; 20 | hack::game::globals::cmd = nullptr; 21 | 22 | return originals::o_createmove ( x86regout , sampletime , cmd ); 23 | } 24 | 25 | if ( !cmd || !cmd->m_cmdnum ) 26 | return originals::o_createmove ( x86regout , sampletime , cmd ); 27 | 28 | /* grab local */ 29 | hack::game::globals::local = hack::game::interfaces::entity_list->get ( hack::game::interfaces::engine->get_local_player ( ) ); 30 | 31 | if ( !hack::game::globals::local ) 32 | return originals::o_createmove ( x86regout , sampletime , cmd ); 33 | 34 | /* grab sendpacket off the previous stackframe and set our other globals properly */ 35 | const auto ebp = *reinterpret_cast< std::uintptr_t * >( reinterpret_cast< std::uintptr_t >( _AddressOfReturnAddress ( ) ) - sizeof ( std::uintptr_t * ) ); 36 | 37 | hack::game::globals::send_packet = reinterpret_cast< bool * >( ebp - 28 ); 38 | hack::game::globals::cmd = cmd; 39 | 40 | /* engine prediction "fix" for low performance users - prevents desync of important values if fps dips below tickrate which might cause commands to not be predicted and ep to use wrong values */ 41 | if ( hack::game::globals::cmd->m_tickcount != hack::modules::rage::tickbase::shifted_cmd.m_tickcount && hack::game::interfaces::global_vars->m_ipt <= hack::game::interfaces::global_vars->m_frametime ) 42 | hack::game::interfaces::prediction->update ( hack::game::interfaces::clientstate->delta_tick , hack::game::interfaces::clientstate->delta_tick > 0 , 43 | hack::game::interfaces::clientstate->last_command_ack , 44 | hack::game::interfaces::clientstate->last_outgoing_command + hack::game::interfaces::clientstate->choked_commands ); 45 | /* fastduck */ 46 | const auto & fastduck = CONFIG_GET ( bool , fnv1a ( "m_noduckdelay" ) ); 47 | 48 | if ( fastduck ) 49 | hack::game::globals::cmd->m_buttons |= sdk::valve::cmd_buttons::in_bullrush; 50 | 51 | hack::modules::misc::movement::in_createmove ( ); 52 | hack::modules::misc::others::in_createmove ( ); 53 | 54 | /* engine prediction */ 55 | hack::modules::prediction::engine_prediction::run_in_prediction ( [ & ] { 56 | hack::modules::misc::movement::in_prediction ( ); 57 | 58 | hack::modules::rage::antiaim::in_movement_fix ( [ & ] { 59 | hack::modules::rage::tickbase::in_createmove ( ); 60 | hack::modules::rage::antiaim::in_prediction ( ); 61 | } ); 62 | } ); 63 | 64 | const auto should_auto_attack = [ & ] ( ) { 65 | auto weapon = hack::game::globals::local->active_weapon ( ); 66 | 67 | if ( !weapon ) 68 | return false; 69 | 70 | return weapon->item_definition_index ( ) == sdk::e_item_definition_index::weapon_c4 || weapon->item_definition_index ( ) == sdk::e_item_definition_index::weapon_revolver || weapon->weapon_kind ( ) == sdk::e_cs_weapon_type::weapontype_grenade; 71 | }; 72 | 73 | if ( !hack::game::globals::local->can_shoot ( ) && hack::game::globals::cmd->m_buttons & sdk::valve::cmd_buttons::in_attack && !should_auto_attack ( ) ) 74 | hack::game::globals::cmd->m_buttons &= ~sdk::valve::cmd_buttons::in_attack; 75 | 76 | hack::game::globals::cmd->m_angs.clamp ( ); 77 | 78 | /* storing shit */ 79 | /* this if statement prevents fakeducking from showing an inaccurate angle on local in thirdperson - i know this is ghetto but i don't give a shit */ 80 | static bool still_choking = false , sent_a_tick = false; 81 | if ( ( still_choking || sent_a_tick ) || ( hack::game::globals::cmd->m_buttons & sdk::valve::cmd_buttons::in_attack && !hack::game::globals::send_packet ) && !should_auto_attack ( ) ) { 82 | if ( ( hack::game::globals::cmd->m_buttons & sdk::valve::cmd_buttons::in_attack && !hack::game::globals::send_packet ) ) 83 | hack::modules::rage::antiaim::last_shot_angles = hack::game::globals::cmd->m_angs; 84 | 85 | if ( hack::game::globals::send_packet ) sent_a_tick = true; 86 | 87 | if ( !sent_a_tick ) still_choking = true; 88 | else if ( !hack::game::globals::send_packet ) still_choking = sent_a_tick = false; 89 | 90 | if ( still_choking || sent_a_tick ) { 91 | hack::modules::rage::antiaim::last_sent_angles = hack::modules::rage::antiaim::last_shot_angles; 92 | hack::modules::rage::antiaim::last_choked_angles = hack::modules::rage::antiaim::last_shot_angles; 93 | } 94 | } else { 95 | if ( hack::game::globals::send_packet ) hack::modules::rage::antiaim::last_sent_angles = hack::game::globals::cmd->m_angs; 96 | else hack::modules::rage::antiaim::last_choked_angles = hack::game::globals::cmd->m_angs; 97 | } 98 | 99 | hack::modules::animations::in_createmove ( ); 100 | 101 | *reinterpret_cast< bool * >( ebp - 28 ) = hack::game::globals::send_packet; 102 | 103 | return false; 104 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/doanimationevent.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | void __fastcall hack::hooks::doanimationevent_hk( x86reg, void * anim_event, int data ) { 4 | originals::o_doanimationevent( x86regout, anim_event, data ); 5 | #ifdef _DEBUG 6 | std::cout << "func called\n"; 7 | #endif /* _DEBUG*/ 8 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/doenginepostprocessing.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | bool __fastcall hack::hooks::doenginepostprocessing_hk ( x86reg , int x , int y , int w , int h , bool flashlight , bool postvgui ) { 4 | return false; 5 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/doextraboneprocessing.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | void __fastcall hack::hooks::doextraboneprocessing_hk ( x86reg , int a2 , int a3 , int a4 , int a5 , int a6 , int a7 ) { 4 | return; 5 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/doproceduralfootplant.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | /* obsoleted by returning in doextraboneprocessing */ 4 | void __fastcall hack::hooks::doproceduralfootplant_hk ( x86reg , void * bonetoworld , void * leftfootchain , void * rightfootchain , void * pos ) { 5 | return; 6 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/drawprinttext.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/framework.hh" 4 | 5 | void __fastcall hack::hooks::drawprinttext_hk ( x86reg , const wchar_t * text , int text_length , void * draw_type ) { 6 | if ( text_length < 10 ) 7 | return originals::o_drawprinttext ( x86regout , text , text_length , draw_type ); 8 | 9 | if ( ( text [ 0 ] == L'f' && text [ 1 ] == L'p' && text [ 2 ] == L's' ) || ( text [ 0 ] == L'l' && text [ 1 ] == L'o' && text [ 2 ] == L's' ) ) { 10 | std::wstring appender; 11 | 12 | if ( text [ 0 ] == L'f' ) 13 | appender = L"software hack for csgo | " + std::to_wstring ( static_cast< int >( hack::menu::globals::framerate ) ) + L" fps | " + std::to_wstring ( hack::menu::globals::realtime ) + L" time"; //L"hello uc!" 14 | else if ( text [ 0 ] == L'l' ) 15 | #if defined(_DEBUG) || defined(LUNAR_DEV) 16 | appender = L"developer build | hi swoopae! "; //L"greetz stacker and alpha"; 17 | #elif defined(LUNAR_ALPHA) 18 | appender = L"alpha build | user: unknown"; //L"greetz stacker and alpha"; 19 | #else 20 | appender = L"user: unknown"; //L"greetz stacker and alpha"; 21 | #endif 22 | 23 | return originals::o_drawprinttext ( ecx , edx , appender.data ( ) , appender.size ( ) , draw_type ); 24 | } 25 | 26 | originals::o_drawprinttext ( x86regout , text , text_length , draw_type ); 27 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/endscene.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/renderer.hh" 4 | #include "../../menu/framework.hh" 5 | 6 | #include "../../modules/misc/others.hh" 7 | #include "../../modules/visuals/esp.hh" 8 | #include "../../modules/visuals/misc.hh" 9 | #include "../../modules/rage/antiaim.hh" 10 | #include "../../modules/rage/tickbase.hh" 11 | 12 | #include 13 | #include 14 | #include "../../modules/misc/movement.hh" 15 | 16 | long __fastcall hack::hooks::endscene_hk ( x86reg , IDirect3DDevice9 * device ) { 17 | static std::uintptr_t gameoverlay_address = 0; // , normal_address = 0; 18 | 19 | const auto ret_add = std::uintptr_t ( _ReturnAddress ( ) ); 20 | 21 | if ( !gameoverlay_address /* || !normal_address */ ) { 22 | MEMORY_BASIC_INFORMATION info; 23 | VirtualQuery ( _ReturnAddress ( ) , &info , sizeof ( MEMORY_BASIC_INFORMATION ) ); 24 | 25 | char mod [ MAX_PATH ]; 26 | GetModuleFileNameA ( ( HMODULE ) info.AllocationBase , mod , MAX_PATH ); 27 | 28 | if ( strstr ( mod , STR ( "gameoverlay" ) ) ) 29 | gameoverlay_address = ret_add; 30 | // else normal_address = ret_add; 31 | } 32 | 33 | /* if streamproof */ 34 | if ( gameoverlay_address != ret_add ) 35 | return originals::o_endscene ( x86regout , device ); 36 | /* else use normal address */ 37 | 38 | IDirect3DStateBlock9 * pixel_state = nullptr; 39 | IDirect3DVertexDeclaration9 * vertex_declaration = nullptr; 40 | IDirect3DVertexShader9 * vertex_shader = nullptr; 41 | 42 | device->CreateStateBlock ( D3DSBT_PIXELSTATE , &pixel_state ); 43 | device->GetVertexDeclaration ( &vertex_declaration ); 44 | device->GetVertexShader ( &vertex_shader ); 45 | 46 | if ( !hack::game::renderer::init ) 47 | if ( hack::game::renderer::do_init ( device ) ) 48 | hack::game::renderer::init = true; 49 | 50 | hack::game::renderer::set_states ( ); 51 | 52 | /* util func */ 53 | const auto clock_to_seconds = [ & ] ( std::clock_t ticks ) { return ( ticks / static_cast< float >( CLOCKS_PER_SEC ) ); }; 54 | 55 | /* calculate frametime */ 56 | static std::clock_t current_time = 0 , old_time = 0; 57 | old_time = current_time; 58 | current_time = std::clock ( ); 59 | 60 | hack::menu::globals::frametime = clock_to_seconds ( current_time - old_time ); 61 | hack::menu::globals::realtime += hack::menu::globals::frametime; 62 | 63 | /* lol ghetto garbage */ 64 | static int frames_drawn = 0; 65 | static float last_fps_time = 0.f; 66 | frames_drawn++; 67 | 68 | if ( hack::menu::globals::realtime > last_fps_time + 1.f ) { 69 | last_fps_time = hack::menu::globals::realtime; 70 | hack::menu::globals::framerate = frames_drawn; 71 | frames_drawn = 0; 72 | } 73 | 74 | /* do draw hacks */ 75 | hack::modules::visuals::esp::in_endscene ( ); 76 | hack::modules::visuals::misc::in_endscene ( ); 77 | 78 | /* draw our shit here */ 79 | hack::menu::impl::run_menu ( ); 80 | 81 | /* grab input shit here */ 82 | hack::modules::misc::others::in_endscene ( ); 83 | hack::modules::rage::antiaim::in_endscene ( ); 84 | hack::modules::misc::movement::in_endscene ( ); 85 | hack::modules::rage::tickbase::in_endscene ( ); 86 | 87 | // hack::game::renderer::text ( c_vector2 ( 5 , 125 ) , c_color ( 255 , 255 , 255 ) , "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ" , hack::game::renderer::fonts::icon_font ); 88 | 89 | /* block/allow input if we're in the menu */ 90 | hack::game::interfaces::input_system->enable_input ( !hack::menu::impl::menu_opened ); 91 | 92 | pixel_state->Apply ( ); 93 | pixel_state->Release ( ); 94 | device->SetVertexDeclaration ( vertex_declaration ); 95 | device->SetVertexShader ( vertex_shader ); 96 | 97 | return originals::o_endscene ( x86regout , device ); 98 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/fireevent.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | 5 | struct event_t { 6 | public: 7 | pad ( 4 ); 8 | float m_delay; 9 | pad ( 48 ); 10 | event_t * m_next; 11 | }; 12 | 13 | bool __fastcall hack::hooks::fireevent_hk ( x86reg ) { 14 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) || !hack::game::globals::local ) 15 | return originals::o_fireevent ( x86regout ); 16 | 17 | auto ei = *reinterpret_cast< event_t ** > ( reinterpret_cast< std::uintptr_t >( hack::game::interfaces::clientstate ) + 0x4E64 ); 18 | 19 | if ( !ei ) 20 | return originals::o_fireevent ( x86regout ); 21 | 22 | event_t * next = nullptr; 23 | 24 | do { 25 | next = ei->m_next; 26 | ei->m_delay = 0.f; 27 | ei = next; 28 | } while ( next ); 29 | 30 | return originals::o_fireevent ( x86regout ); 31 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/framestagenotify.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/animations/animations.hh" 4 | #include "../../modules/misc/others.hh" 5 | 6 | #include "../../menu/framework.hh" 7 | 8 | void __fastcall hack::hooks::framestagenotify_hk ( x86reg , int stage ) { 9 | hack::modules::animations::in_framestagenotify ( stage ); 10 | 11 | originals::o_framestagenotify ( x86regout , stage ); 12 | 13 | hack::modules::misc::others::in_fsn ( stage ); 14 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/getalphamodulation.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/config.hh" 4 | 5 | float __fastcall hack::hooks::getalphamodulation_hk ( x86reg ) { 6 | /* sanity checks */ 7 | if ( !hack::game::interfaces::engine->is_connected ( ) || !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::globals::local ) 8 | return originals::o_getalphamodulation ( x86regout ); 9 | 10 | const auto & fx_world_modulation = CONFIG_GET ( bool , fnv1a ( "fx_world_modulation" ) ); 11 | 12 | if ( !fx_world_modulation ) 13 | return originals::o_getalphamodulation ( x86regout ); 14 | 15 | const auto mat = reinterpret_cast< sdk::valve::material_t * >( ecx ); 16 | 17 | if ( !mat ) 18 | return originals::o_getalphamodulation ( x86regout ); 19 | 20 | const auto group = fnv1a_rt ( mat->get_texture_group_name ( ) ); 21 | 22 | if ( group != fnv1a ( "StaticProp textures" ) ) 23 | return originals::o_getalphamodulation ( x86regout ); 24 | 25 | const auto & fx_world_modulation_color = CONFIG_GET ( c_color , fnv1a ( "fx_world_modulation_color" ) ); 26 | 27 | return ( fx_world_modulation_color.a / 255.f > 0.96f ) ? 1.f : fx_world_modulation_color.a / 255.f; 28 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/getcolormodulation.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/config.hh" 4 | 5 | void __fastcall hack::hooks::getcolormodulation_hk ( x86reg , float * r , float * g , float * b ) { 6 | /* sanity checks */ 7 | if ( !hack::game::interfaces::engine->is_connected ( ) || !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::globals::local ) 8 | return originals::o_getcolormodulation ( x86regout , r , g , b ); 9 | 10 | originals::o_getcolormodulation ( x86regout , r , g , b ); 11 | 12 | const auto material = reinterpret_cast< sdk::valve::material_t * >( ecx ); 13 | 14 | if ( !material ) 15 | return; 16 | 17 | const auto group = fnv1a_rt ( material->get_texture_group_name ( ) ); 18 | 19 | if ( group != fnv1a ( "World textures" ) && group != fnv1a ( "StaticProp textures" ) && group != fnv1a ( "SkyBox textures" ) ) 20 | return; 21 | 22 | const auto & fx_world_modulation = CONFIG_GET ( bool , fnv1a ( "fx_world_modulation" ) ); 23 | 24 | if ( !fx_world_modulation ) 25 | return; 26 | 27 | const auto & fx_world_modulation_color = CONFIG_GET ( c_color , fnv1a ( "fx_world_modulation_color" ) ); 28 | 29 | const auto is_prop = group == fnv1a ( "StaticProp textures" ); 30 | 31 | *r *= is_prop ? 0.5f * ( fx_world_modulation_color.r / 255.f ) : 0.23f * ( fx_world_modulation_color.r / 255.f ); 32 | *g *= is_prop ? 0.5f * ( fx_world_modulation_color.g / 255.f ) : 0.23f * ( fx_world_modulation_color.g / 255.f ); 33 | *b *= is_prop ? 0.5f * ( fx_world_modulation_color.b / 255.f ) : 0.23f * ( fx_world_modulation_color.b / 255.f ); 34 | } 35 | -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/getviewangles.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | #include "../../modules/rage/antiaim.hh" 5 | 6 | #include 7 | 8 | c_vector3 * __fastcall hack::hooks::getviewangles_hk ( x86reg ) { 9 | /* sanity checks */ 10 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) ) 11 | return originals::o_getviewangles ( x86regout ); 12 | 13 | if ( !hack::game::globals::local || !hack::game::globals::cmd || !hack::game::globals::local->alive ( ) ) 14 | return originals::o_getviewangles ( x86regout ); 15 | 16 | if ( !ecx ) 17 | return originals::o_getviewangles ( x86regout ); 18 | 19 | /* oops forgot about this */ 20 | if ( ecx != hack::game::globals::local ) 21 | return originals::o_getviewangles ( x86regout ); 22 | 23 | const static auto ret_to_tp_pitch = sig ( MODULE_CLIENT_PANORAMA , STR ( "8B CE F3 0F 10 00 8B 06 F3 0F 11 45 ? FF 90 ? ? ? ? F3 0F 10 55" ) ); 24 | const static auto ret_to_tp_yaw = sig ( MODULE_CLIENT_PANORAMA , STR ( "F3 0F 10 55 ? 51 8B 8E" ) ); 25 | 26 | if ( ( uintptr_t ) _ReturnAddress ( ) == ret_to_tp_pitch 27 | || ( uintptr_t ) _ReturnAddress ( ) == ret_to_tp_yaw ) 28 | return &hack::modules::rage::antiaim::last_sent_angles; 29 | 30 | return originals::o_getviewangles ( x86regout ); 31 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/inprediction.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include 4 | 5 | bool __fastcall hack::hooks::inprediction_hk ( x86reg ) { 6 | static const auto cbaseanimunkn_retaddr = sig ( MODULE_CLIENT_PANORAMA , STR ( "84 C0 74 17 8B 87" ) ); /* TODO: check src leak ~swoopae */ 7 | static const auto setupbones_retaddr = sig ( MODULE_CLIENT_PANORAMA , STR ( "84 C0 74 0A F3 0F 10 05 ? ? ? ? EB 05" ) ); 8 | 9 | const auto retaddr = reinterpret_cast< std::uintptr_t >( _ReturnAddress ( ) ); 10 | 11 | /* return false cuz game overrides our current time with saved prediction time thanks valve */ 12 | if ( retaddr == setupbones_retaddr ) 13 | return false; 14 | 15 | /* fixes some weird ass oddity */ 16 | if ( retaddr == cbaseanimunkn_retaddr ) 17 | return true; 18 | 19 | return originals::o_inprediction ( x86regout ); 20 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/interpolateserverentities.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/animations/animations.hh" 4 | 5 | void __fastcall hack::hooks::interpolateserverentities_hk ( x86reg ) { 6 | originals::o_interpolateserverentities ( x86regout ); 7 | 8 | if ( hack::game::globals::local && hack::game::globals::local->valid ( ) && hack::game::globals::cmd ) { 9 | /* set proper info */ 10 | hack::game::globals::local->set_absolute_angles ( hack::modules::animations::last_sent_absyaw ); 11 | 12 | /* correct render bone matrix */ 13 | /* CREDZzZz: @alpha */ 14 | const auto angle_matrix = [ ] ( const c_vector3 & angle , const c_vector3 & position , c_matrix3x4 & out ) { 15 | const static auto fn = reinterpret_cast< void ( __fastcall * )( const c_vector3 & , c_matrix3x4 & ) >( shared::memory::get_func_addr_relative ( sig ( MODULE_CLIENT_PANORAMA , STR ( "E8 ? ? ? ? 83 FF 03" ) ) ) ); 16 | fn ( angle , out ); 17 | 18 | /* set matrix origin */ 19 | out [ 0 ][ 3 ] = position.x; 20 | out [ 1 ][ 3 ] = position.y; 21 | out [ 2 ][ 3 ] = position.z; 22 | }; 23 | 24 | /* variables */ 25 | c_matrix3x4 new_matrix {}; 26 | std::uint32_t bone_computed [ 8 ] = { 0 }; 27 | 28 | angle_matrix ( hack::game::globals::local->absolute_angles ( ) , hack::game::globals::local->absolute_origin ( ) , new_matrix ); 29 | 30 | const auto backup_matrix = hack::game::globals::local->bone_accesor ( ).m_bones; 31 | 32 | hack::modules::animations::allow_setup_bones = true; 33 | 34 | /* thx alpha 4 codenz */ 35 | hack::game::globals::local->studio_build_matrices ( hack::game::globals::local->studio_hdr ( ) , new_matrix , hack::modules::animations::local_bones_pos , hack::modules::animations::local_bones_quat , 0x7ff00 , hack::modules::animations::local_real_bones , bone_computed ); 36 | 37 | /* invalidate bone cache */ 38 | hack::game::globals::local->invalidate_bone_cache ( ); 39 | 40 | hack::game::globals::local->bone_accesor ( ).m_readable = hack::game::globals::local->bone_accesor ( ).m_writeable = 0xFFFFFFFF; 41 | hack::game::globals::local->bone_accesor ( ).m_bones = hack::modules::animations::local_real_bones; 42 | 43 | /* call attachment helper directly */ 44 | hack::game::globals::local->attachment_helper ( ); 45 | 46 | hack::game::globals::local->bone_accesor ( ).m_bones = backup_matrix; 47 | 48 | hack::modules::animations::allow_setup_bones = false; 49 | } 50 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/ishltv.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | 5 | #include "../../modules/animations/animations.hh" 6 | 7 | #include 8 | 9 | bool __fastcall hack::hooks::ishltv_hk ( x86reg ) { 10 | /* sanity checks */ 11 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) ) 12 | return originals::o_ishltv ( x86regout ); 13 | 14 | if ( !hack::game::globals::local || !hack::game::globals::cmd || !hack::game::globals::local->alive ( ) ) 15 | return originals::o_ishltv ( x86regout ); 16 | 17 | const auto current_address = std::uintptr_t ( _ReturnAddress ( ) ); 18 | 19 | const static auto anim_lod_address = sig ( MODULE_CLIENT_PANORAMA , STR ( "84 C0 0F 85 ? ? ? ? A1 ? ? ? ? 8B B7" ) ); 20 | const static auto setup_velocity_address = sig ( MODULE_CLIENT_PANORAMA , STR ( "84 C0 75 38 8B 0D ? ? ? ? 8B 01 8B 80" ) ); 21 | const static auto accumulate_layers_address = sig ( MODULE_CLIENT_PANORAMA , STR ( "84 C0 75 0D F6 87" ) ); 22 | 23 | if ( hack::modules::animations::in_local_animfix && current_address != accumulate_layers_address ) 24 | return originals::o_ishltv ( x86regout ); 25 | 26 | if ( current_address == anim_lod_address || 27 | current_address == setup_velocity_address || 28 | current_address == accumulate_layers_address ) 29 | return true; 30 | 31 | return originals::o_ishltv ( x86regout ); 32 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/isusingstaticpropdebug.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/config.hh" 4 | 5 | bool __fastcall hack::hooks::isusingstaticpropdebug_hk ( x86reg ) { 6 | const auto & fx_world_modulation = CONFIG_GET ( bool , fnv1a ( "fx_world_modulation" ) ); 7 | 8 | return fx_world_modulation; 9 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/levelshutdown.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | 5 | #include "../../modules/misc/others.hh" 6 | #include "../../modules/animations/animations.hh" 7 | 8 | void __fastcall hack::hooks::levelshutdown_hk ( x86reg ) { 9 | /* prevents some weird crashes */ 10 | hack::game::globals::cmd = nullptr; 11 | hack::game::globals::local = nullptr; 12 | hack::game::globals::send_packet = true; 13 | 14 | for ( auto & iter : hack::modules::misc::others::weapon_name ) 15 | iter.first.empty ( ); 16 | 17 | /* reset animfix records */ 18 | /* flush cached data */ 19 | for ( auto & iter : hack::modules::animations::animation_system->m_animation_info ) { 20 | /* reset important data */ 21 | iter.m_player = nullptr; 22 | iter.m_handle = 0; 23 | iter.m_missed_shots = 0; 24 | iter.m_spawntime = 0.f; 25 | iter.m_should_resolve = false; 26 | 27 | /* reset resolver data */ 28 | iter.m_last_resolver_state = hack::modules::animations::e_resolver_state::resolver_auto; 29 | iter.m_resolved_side = hack::modules::animations::e_resolver_side::side_auto; 30 | 31 | /* erase all records if we have any */ 32 | if ( !iter.m_recieved_frames.empty ( ) ) 33 | iter.m_recieved_frames.clear ( ); 34 | } 35 | 36 | originals::o_levelshutdown ( x86regout ); 37 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/lockcursor.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/framework.hh" 4 | 5 | void __fastcall hack::hooks::lockcursor_hk ( x86reg ) { 6 | if ( hack::menu::impl::menu_opened ) { 7 | hack::game::interfaces::surface->unlock_cursor ( ); 8 | return; 9 | } 10 | 11 | originals::o_lockcursor ( x86regout ); 12 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/overrideview.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | #include "../../menu/config.hh" 5 | 6 | #include "../../modules/misc/others.hh" 7 | 8 | void __fastcall hack::hooks::overrideview_hk ( x86reg , sdk::valve::c_viewsetup * setup ) { 9 | if ( !setup ) 10 | return originals::o_overrideview ( x86regout , setup ); 11 | 12 | if ( hack::game::interfaces::engine->is_connected ( ) && hack::game::interfaces::engine->is_in_game ( ) && hack::game::globals::local ) { 13 | const auto & fx_fov = CONFIG_GET ( int , fnv1a ( "fx_fov" ) ); 14 | const auto & fx_fov_override = CONFIG_GET ( bool , fnv1a ( "fx_fov_override" ) ); 15 | 16 | if ( !hack::game::globals::local->scoped ( ) ) 17 | setup->m_fov = fx_fov; 18 | 19 | if ( fx_fov_override ) 20 | setup->m_fov = fx_fov; 21 | 22 | hack::modules::misc::others::in_overrideview ( setup ); 23 | } 24 | 25 | originals::o_overrideview ( x86regout , setup ); 26 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/painttraverse.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/framework.hh" 4 | #include "../../modules/misc/others.hh" 5 | 6 | void __fastcall hack::hooks::painttraverse_hk ( x86reg , std::uint32_t vguipanel , bool repaint , bool force ) { 7 | originals::o_painttraverse ( x86regout , vguipanel , repaint , force ); 8 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/performprediction.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | void __fastcall hack::hooks::performprediction_hk ( x86reg , int slot , sdk::c_player * local , bool received_new_world_update , int incoming_acknowledged , int outgoing_command ) { 4 | // std::cout << "CPrediction::PerformPrediction - running on command " << outgoing_command << '\n'; 5 | originals::o_performprediction ( x86regout , slot , local , received_new_world_update , incoming_acknowledged , outgoing_command ); 6 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/reset.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include 4 | #include "../../game/renderer.hh" 5 | 6 | long __fastcall hack::hooks::reset_hk ( x86reg , IDirect3DDevice9 * device , D3DPRESENT_PARAMETERS * presentation_parameters ) { 7 | if ( !hack::game::renderer::init ) 8 | return originals::o_reset ( x86regout , device , presentation_parameters ); 9 | 10 | hack::game::renderer::reset ( ); 11 | 12 | const auto orig = originals::o_reset ( x86regout , device , presentation_parameters ); 13 | 14 | hack::game::renderer::do_init ( device ); 15 | 16 | return orig; 17 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/runcommand.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/prediction/engine_prediction.hh" 4 | #include "../../modules/rage/tickbase.hh" 5 | #include "../../modules/animations/animations.hh" 6 | 7 | #include "../../../sdk/math/mathutils.hh" 8 | 9 | #include "../../menu/config.hh" 10 | 11 | /* hahahahahahahhahahahahahahahhahahahahahahah -swoopae from future */ 12 | void __fastcall hack::hooks::runcommand_hk ( x86reg , sdk::c_player * player , sdk::valve::ucmd_t * cmd , sdk::valve::c_move_helper * helper ) { 13 | if ( player == hack::game::globals::local ) { 14 | static auto sv_max_usercmd_future_ticks = hack::game::interfaces::convar_system->get_convar ( STR ( "sv_max_usercmd_future_ticks" ) ); /* used to detect prediction issues */ 15 | 16 | /* TODO: recharging fix & account for ping - this only acts perfectly in low ping situations and on local servers. with high ping i'm sure it'll fuck up */ 17 | static int tickbase_difference = 2; 18 | static int old_tickbase = 0; 19 | 20 | if ( hack::modules::rage::tickbase::shift_amount == 15 ) { 21 | if ( cmd->m_cmdnum == hack::modules::rage::tickbase::shifted_cmd.m_cmdnum ) { 22 | tickbase_difference = hack::game::globals::local->tickbase ( ) - cmd->m_tickcount; 23 | player->tickbase ( ) = cmd->m_tickcount + ( hack::modules::rage::tickbase::shift_amount - 12 ); 24 | } 25 | } else { 26 | if ( cmd->m_cmdnum == hack::modules::rage::tickbase::shifted_cmd.m_cmdnum && hack::modules::rage::tickbase::shift_amount - 11 > 0 ) { 27 | player->tickbase ( ) = old_tickbase - ( hack::modules::rage::tickbase::shift_amount - 12 ); 28 | } 29 | } 30 | 31 | old_tickbase = player->tickbase ( ); 32 | 33 | /* TODO: unfuck revolver also other things ~swoopae */ 34 | 35 | /* fix for velocity modifier */ 36 | const auto velmod = player->velocity_modifier ( ); 37 | 38 | /* call orig */ 39 | originals::o_runcommand ( x86regout , player , cmd , helper ); 40 | 41 | /* fix for 14 tick ONLY */ 42 | if ( hack::modules::rage::tickbase::shift_amount == 14 ) { 43 | if ( cmd->m_cmdnum == hack::modules::rage::tickbase::shifted_cmd.m_cmdnum + 1 ) { 44 | player->tickbase ( ) += tickbase_difference + 1; 45 | } 46 | } 47 | 48 | /* fix for some prediction errors */ 49 | player->collision_state ( ) = 0; 50 | 51 | if ( velmod != -FLT_MAX && velmod != FLT_MAX ) 52 | player->velocity_modifier ( ) = velmod; 53 | 54 | /* get uncompressed netvar data */ 55 | // hack::modules::prediction::engine_prediction::store_netvars ( ); 56 | 57 | return; 58 | } 59 | 60 | originals::o_runcommand ( x86regout , player , cmd , helper ); 61 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/setupbones.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/animations/animations.hh" 4 | 5 | bool __fastcall hack::hooks::setupbones_hk ( x86reg , c_matrix3x4 * bone_to_world , int max_bones , int bone_mask , float time ) { 6 | /* sanity checks */ 7 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) || 8 | !hack::game::globals::local ) 9 | return originals::o_setupbones ( x86regout , bone_to_world , max_bones , bone_mask , time ); 10 | 11 | if ( !ecx ) 12 | return originals::o_setupbones ( x86regout , bone_to_world , max_bones , bone_mask , time ); 13 | 14 | if ( GetAsyncKeyState ( VK_LSHIFT ) ) 15 | return true; 16 | 17 | /* grab player from iclientrenderable */ 18 | const auto player = reinterpret_cast< sdk::c_player * >( std::uintptr_t ( ecx ) - 0x4 ); 19 | 20 | /* player check */ 21 | if ( !player->index ( ) || player->index ( ) > 64 ) 22 | return originals::o_setupbones ( x86regout , bone_to_world , max_bones , bone_mask , time ); 23 | 24 | /* if we allow setup bones , call original */ 25 | if ( hack::modules::animations::allow_setup_bones ) 26 | return originals::o_setupbones ( x86regout , bone_to_world , max_bones , bone_mask , time ); 27 | 28 | /* if we're local , copy last calculated bones and return */ 29 | if ( player == hack::game::globals::local ) { 30 | /* what the game does */ 31 | if ( max_bones < player->bone_cache ( ).get_count ( ) ) 32 | return false; 33 | 34 | if ( bone_to_world ) 35 | std::memcpy ( bone_to_world , player->bone_cache ( ).base ( ) , sizeof ( c_matrix3x4 ) * player->bone_cache ( ).get_count ( ) ); 36 | 37 | /* return */ 38 | return true; 39 | } 40 | 41 | return originals::o_setupbones ( x86regout , bone_to_world , max_bones , bone_mask , time ); 42 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/shouldinterpolate.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | bool __fastcall hack::hooks::shouldinterpolate_hk ( x86reg ) { 4 | if ( !ecx ) 5 | return originals::o_shouldinterpolate ( x86regout ); 6 | 7 | const auto entity = reinterpret_cast< sdk::c_player * >( ecx ); 8 | 9 | if ( entity->index ( ) < 1 && entity->index ( ) > 64 ) 10 | return originals::o_shouldinterpolate ( x86regout ); 11 | 12 | return false; 13 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/shouldskipanimframe.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | bool __fastcall hack::hooks::shouldskipanimframe_hk ( x86reg ) { 4 | return false; 5 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/standardblendingrules.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | void __fastcall hack::hooks::standardblendingrules_hk ( x86reg , int a2 , int a3 , int a4 , int a5 , int a6 ) { 4 | /* sanity check */ 5 | if ( !ecx ) 6 | return originals::o_standardblendingrules ( x86regout , a2 , a3 , a4 , a5 , a6 ); 7 | 8 | const auto entity = reinterpret_cast< sdk::c_player * >( ecx ); 9 | 10 | /* force disable interpolation for all entities */ 11 | /* call standardblendingrules with EF_NOINTERP */ 12 | *( std::uint32_t * ) ( ( std::uintptr_t ) entity + 0xF0 ) |= 8; 13 | 14 | originals::o_standardblendingrules ( x86regout , a2 , a3 , a4 , a5 , a6 ); 15 | 16 | *( std::uint32_t * ) ( ( std::uintptr_t ) entity + 0xF0 ) &= ~8; 17 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/svcheatsgetbool.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../game/globals.hh" 4 | 5 | #include 6 | 7 | bool __fastcall hack::hooks::svcheatsgetbool_hk ( x86reg ) { 8 | /* sanity checks */ 9 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) || !hack::game::globals::local ) 10 | return originals::o_svcheatsgetbool ( x86regout ); 11 | 12 | static const auto cam_think = sig ( MODULE_CLIENT_PANORAMA , STR ( "85 C0 75 30 38 86" ) ); 13 | 14 | if ( _ReturnAddress ( ) == reinterpret_cast< void * >( cam_think ) ) 15 | return true; 16 | 17 | return originals::o_svcheatsgetbool ( x86regout ); 18 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/update.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/animations/animations.hh" 4 | 5 | void __vectorcall hack::hooks::update_hk ( x86reg , float a1 , float a2 , float a3 , void * a4 ) { 6 | if ( !ecx ) 7 | return; 8 | 9 | if ( hack::game::globals::local && ecx == hack::game::globals::local->animstate ( ) && !hack::modules::animations::in_local_animfix ) 10 | return; 11 | 12 | if ( hack::modules::animations::allow_clientside_anims ) 13 | originals::o_update ( x86regout , a1 , a2 , a3 , a4 ); 14 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/updateclientsideanimations.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/animations/animations.hh" 4 | 5 | void __fastcall hack::hooks::updateclientsideanimations_hk ( x86reg ) { 6 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::interfaces::engine->is_connected ( ) ) 7 | return originals::o_updateclientsideanimations ( x86regout ); 8 | 9 | if ( !hack::game::globals::local || !hack::game::globals::local->valid ( ) || !hack::game::globals::cmd ) 10 | return originals::o_updateclientsideanimations ( x86regout ); 11 | 12 | /* not interested in teammates so let them update as normal */ 13 | if ( reinterpret_cast< sdk::c_player * >( ecx )->teammate ( ) ) 14 | return originals::o_updateclientsideanimations ( x86regout ); 15 | 16 | /* special for local */ 17 | if ( ecx == hack::game::globals::local && !hack::modules::animations::in_local_animfix ) 18 | return; 19 | 20 | /* only run update if we allow it */ 21 | if ( !hack::modules::animations::allow_clientside_anims ) 22 | return; 23 | 24 | originals::o_updateclientsideanimations ( x86regout ); 25 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/vertexbufferdx10lock.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../menu/config.hh" 4 | 5 | void __fastcall hack::hooks::vertexbufferdx10lock_hk ( x86reg , int max_vertex_count , bool append , void * unk ) { 6 | /* lol no */ 7 | 8 | originals::o_vertexbufferlock ( x86regout , max_vertex_count , append , unk ); 9 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/hooks/functions/writeucmddeltatobuffer.cc: -------------------------------------------------------------------------------- 1 | #include "../handler.hh" 2 | 3 | #include "../../modules/rage/tickbase.hh" 4 | 5 | #include 6 | 7 | bool __fastcall hack::hooks::writeucmddeltatobuffer_hk ( x86reg , int a1 , void * a2 , int a3 , int a4 , bool a5 ) { 8 | return hack::modules::rage::tickbase::in_writeucmddelta ( ecx , edx , a1 , a2 , a3 , a4 , a5 ); 9 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/config.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef LUNAR_CONFIG 4 | #define LUNAR_CONFIG 5 | 6 | #include "../../external/hasher/hasher.hh" 7 | #include "../../shared/color/color.hh" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | /* use me to avoid namespace aids */ 14 | #define CONFIG_ADD(type,hash,val) \ 15 | hack::variables::options->add ( hash , val ); 16 | 17 | /* use me to avoid namespace aids */ 18 | #define CONFIG_GET(type,hash) \ 19 | hack::variables::options->get ( hash ); 20 | 21 | /* doesn't work */ 22 | #define CONFIG_STATIC_GET(type,hash) \ 23 | ( [ ] ( ) { \ 24 | const static auto val = hack::variables::options->m_options.find ( hash ); \ 25 | auto value = *( type* ) &val._Ptr->_Myval.second; \ 26 | return &value; \ 27 | } ) ( ) 28 | 29 | /* macro that creates unique lambda that handles keybind shit - is unique only because of toggle option and i cannot be bothered to make a huge bool array for every keybind */ 30 | #define HANDLE_KEYBIND( x ) \ 31 | [ ] ( ) { \ 32 | const auto& meme = CONFIG_GET ( keybind_t , x ); \ 33 | if(!meme.m_key && meme.m_type) return false; \ 34 | switch ( meme.m_type ) { \ 35 | case 0: \ 36 | return true; \ 37 | break; \ 38 | case 1: { \ 39 | static bool toggle = false; \ 40 | if ( hack::menu::input::key_released ( meme.m_key ) ) \ 41 | toggle = !toggle; \ 42 | return toggle; \ 43 | break; \ 44 | } \ 45 | case 2: \ 46 | return hack::menu::input::key_down ( meme.m_key ); \ 47 | break; \ 48 | } \ 49 | }; 50 | 51 | struct keybind_t { 52 | keybind_t ( int type ) { this->m_type = type; this->m_key = 0; } 53 | 54 | unsigned char m_key , m_type; 55 | }; 56 | 57 | namespace hack::variables { 58 | enum option_type_t { 59 | option_bool = 0 , 60 | option_int , 61 | option_float , 62 | option_string , 63 | option_clr , 64 | option_keybind 65 | }; 66 | 67 | struct option_t { 68 | public: 69 | std::uint32_t m_hash; 70 | 71 | option_type_t m_type; 72 | 73 | union values_t { 74 | c_color m_clr; 75 | keybind_t m_kbind; 76 | int m_ioption; 77 | float m_foption; 78 | char m_stroption [ 256 ]; 79 | 80 | values_t ( ) { } 81 | } values; 82 | 83 | option_t ( std::uint32_t hash , option_type_t type , values_t v ) { 84 | m_hash = hash; 85 | m_type = type; 86 | values = v; 87 | }; 88 | }; 89 | 90 | class c_options { 91 | public: 92 | std::unordered_map< std::uint32_t , option_t > m_options; 93 | public: 94 | ~c_options ( ) { } 95 | 96 | template < typename t > 97 | void add ( std::uint32_t hash , t val ) { 98 | option_type_t type = option_bool; 99 | option_t::values_t values; 100 | 101 | std::memset ( &values , 0 , sizeof ( option_t::values_t ) ); 102 | 103 | if ( std::is_same< const char * , t >::value ) 104 | std::memcpy ( &values , ( void * ) *( std::uintptr_t * )( &val ) , sizeof ( values.m_stroption ) ); 105 | else 106 | std::memcpy ( &values , &val , sizeof ( t ) ); 107 | 108 | if ( std::is_same< bool , t >::value ) 109 | type = option_bool; 110 | else if ( std::is_same< int , t >::value ) 111 | type = option_int; 112 | else if ( std::is_same< float , t >::value ) 113 | type = option_float; 114 | else if ( std::is_same< const char * , t >::value ) 115 | type = option_string; 116 | else if ( std::is_same< c_color , t >::value ) 117 | type = option_clr; 118 | else if ( std::is_same< keybind_t , t >::value ) 119 | type = option_keybind; 120 | 121 | m_options.emplace ( hash , option_t ( hash , type , values ) ); 122 | } 123 | public: 124 | template < typename t > 125 | t & get ( std::uint32_t hash ) { 126 | const auto val = m_options.find ( hash ); 127 | 128 | if ( &val._Ptr->_Myval.second.values ) 129 | return *( t * ) &val._Ptr->_Myval.second.values; 130 | 131 | return *( t * ) nullptr; 132 | } 133 | 134 | void save ( std::string file ) { 135 | } 136 | void load ( std::string file ) { 137 | } 138 | }; 139 | 140 | inline std::unique_ptr< c_options > options = std::make_unique< c_options > ( ); 141 | } 142 | 143 | #endif /* LUNAR_CONFIG */ -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_checkbox.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_checkbox::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | this->m_size.x = ( size.x - 44 ); 5 | } 6 | 7 | void hack::menu::controls::c_checkbox::think ( const c_vector2 & pos ) { 8 | if ( m_hash && m_hash != this->m_value_hash ) { 9 | /* handle children of our element and return */ 10 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 11 | 12 | for ( auto & child : this->m_children ) { 13 | child->think ( cursor ); 14 | cursor.x -= 35; 15 | } 16 | return; 17 | } 18 | 19 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 20 | 21 | auto & value = CONFIG_GET ( bool , this->m_value_hash ); 22 | 23 | if ( input::key_released ( 1 ) && input::mouse_in_region ( pos.x , pos.y , text_size.y + 10 + text_size.x , text_size.y ) ) { 24 | value = !value; 25 | this->m_last_click_animtime = 1.f; 26 | } 27 | 28 | /* handle children of our element */ 29 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 30 | 31 | for ( auto & child : this->m_children ) { 32 | child->think ( cursor ); 33 | cursor.x -= 35; 34 | } 35 | } 36 | 37 | void hack::menu::controls::c_checkbox::draw ( c_vector2 & pos ) { 38 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 39 | 40 | auto & value = CONFIG_GET ( bool , this->m_value_hash ); 41 | 42 | hack::game::renderer::filled_rectangle ( pos , c_vector2 ( text_size.y , text_size.y ) , c_color ( 54 , 54 , 54 , 130 ) ); 43 | 44 | /* do clipping */ 45 | const auto old_viewport = hack::game::renderer::start_clipping ( pos , c_vector2 ( text_size.y , text_size.y ) ); 46 | 47 | /* draw our animation */ 48 | if ( this->m_last_click_animtime > 0.1f ) { 49 | if ( value ) { 50 | const auto factor = std::fabsf ( this->m_last_click_animtime - 1.f ); 51 | 52 | hack::game::renderer::filled_circle ( c_vector2 ( pos.x + ( text_size.y / 2 ) , pos.y + ( text_size.y / 2 ) ) , text_size.y * utils::ease_out_quart ( factor ) , 45 , c_color ( 70 , 70 , 70 , 255 ) ); 53 | } else { 54 | hack::game::renderer::filled_circle ( c_vector2 ( pos.x + ( text_size.y / 2 ) , pos.y + ( text_size.y / 2 ) ) , text_size.y * utils::ease_in_quart ( this->m_last_click_animtime ) , 45 , c_color ( 70 , 70 , 70 , 255 ) ); 55 | } 56 | 57 | this->m_last_click_animtime -= globals::frametime; 58 | } else if ( value ) { 59 | hack::game::renderer::filled_rectangle ( pos , c_vector2 ( text_size.y , text_size.y ) , c_color ( 70 , 70 , 70 , 255 ) ); 60 | } 61 | 62 | /* undo clipping */ 63 | hack::game::renderer::end_clipping ( old_viewport ); 64 | 65 | hack::game::renderer::text ( c_vector2 ( pos.x + text_size.y + 10 , pos.y ) , c_color ( 255 , 255 , 255 ) , this->m_name.data ( ) , hack::game::renderer::fonts::menu_font ); 66 | 67 | /* handle children of our element */ 68 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 69 | 70 | for ( auto & child : this->m_children ) { 71 | child->draw ( cursor ); 72 | cursor.x -= 35; 73 | } 74 | 75 | pos.y += text_size.y + 7; 76 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_colorpicker.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_colorpicker::think ( const c_vector2 & pos ) { 4 | /* if we aren't the top most element and there's some other element blocking input */ 5 | if ( this->m_value_hash != m_hash && m_hash ) 6 | return; 7 | 8 | const auto text_size = hack::game::renderer::text_position ( STR ( "pt" ) , hack::game::renderer::fonts::menu_font ); 9 | const auto element_size = c_vector2 ( 30 , text_size.y ); 10 | 11 | if ( input::key_released ( 1 ) && input::mouse_in_region ( pos.x , pos.y , element_size.x , element_size.y ) ) { 12 | m_hash = this->m_value_hash; 13 | this->m_animtime = 0.f; 14 | } 15 | 16 | /* if we aren't blocking input */ 17 | if ( this->m_value_hash != m_hash ) 18 | return; 19 | 20 | const auto popup_pos = c_vector2 ( pos.x + element_size.x + 10 , pos.y ); 21 | const auto popup_size = c_vector2 ( 200 , 220 ); 22 | 23 | if ( input::key_released ( 1 ) && !input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_animtime > 0.8f ) { 24 | m_hash = 0; 25 | this->m_animtime = 0.f; 26 | 27 | return; 28 | } 29 | 30 | /* in color rectangle */ 31 | if ( input::key_down ( 1 ) && input::mouse_in_region ( popup_pos.x + 5 , popup_pos.y + 5 , popup_size.x - 10 , popup_size.x - 10 ) ) { 32 | /* get x "slider" value */ 33 | const auto x_value_mapped = std::fabsf ( static_cast< float >( input::mouse_pos.x - ( popup_pos.x + 5 ) ) / ( popup_size.x - 10 ) ); 34 | 35 | /* get y "slider" value */ 36 | const auto y_value_mapped = std::fabsf ( static_cast< float >( input::mouse_pos.y - ( popup_pos.y + 5 ) ) / ( popup_size.x - 10 ) - 1.f ); 37 | 38 | /* set cute little cursor value */ 39 | this->m_colpos = c_vector2 ( input::mouse_pos.x - ( popup_pos.x + 5 ) - 2 , input::mouse_pos.y - ( popup_pos.x + 5 ) - 2 ); 40 | 41 | auto & value = CONFIG_GET ( c_color , this->m_value_hash ); 42 | 43 | /* lerp between the colors */ 44 | c_color white ( 255 , 255 , 255 ) , black ( 0 , 0 , 0 ) , hue_col = c_color::from_hsv ( this->m_hue , 1.f , 0.5f ); 45 | c_color white_diff = c_color ( white.r - hue_col.r , white.g - hue_col.g , white.b - hue_col.b ); 46 | hue_col = c_color ( white.r - ( white_diff.r * x_value_mapped ) , white.g - ( white_diff.g * x_value_mapped ) , white.b - ( white_diff.b * x_value_mapped ) , m_transparency * 255 ); 47 | hue_col = c_color ( black.r + ( hue_col.r * y_value_mapped ) , black.g + ( hue_col.g * y_value_mapped ) , black.b + ( hue_col.b * y_value_mapped ) , m_transparency * 255 ); 48 | 49 | /* hope to god this is correct and set the color */ 50 | value = hue_col; 51 | } 52 | 53 | /* hue bar */ 54 | if ( input::key_down ( 1 ) && input::mouse_in_region ( popup_pos.x + 5 , popup_pos.y + 5 + popup_size.x - 7 , popup_size.x - 10 , 6 ) ) { 55 | /* get x "slider" value */ 56 | const auto x_value_mapped = std::fabsf ( static_cast< float >( input::mouse_pos.x - ( popup_pos.x + 5 ) ) / ( popup_size.x - 10 ) ); 57 | 58 | /* set new hue */ 59 | this->m_hue = 360.f * x_value_mapped; 60 | } 61 | 62 | /* transparency bar */ 63 | if ( input::key_down ( 1 ) && input::mouse_in_region ( popup_pos.x + 5 , popup_pos.y + 5 + popup_size.x + 3 , popup_size.x - 10 , 6 ) ) { 64 | /* get x "slider" value */ 65 | const auto x_value_mapped = std::fabsf ( static_cast< float >( input::mouse_pos.x - ( popup_pos.x + 5 ) ) / ( popup_size.x - 10 ) - 1.f ); 66 | 67 | /* set new transparency */ 68 | this->m_transparency = x_value_mapped; 69 | } 70 | } 71 | 72 | void hack::menu::controls::c_colorpicker::draw ( const c_vector2 & pos ) { 73 | const auto text_size = hack::game::renderer::text_position ( STR ( "pt" ) , hack::game::renderer::fonts::menu_font ); 74 | 75 | auto & value = CONFIG_GET ( c_color , this->m_value_hash ); 76 | 77 | const auto element_size = c_vector2 ( 30 , text_size.y ); 78 | 79 | hack::game::renderer::filled_rectangle ( pos , element_size , c_color ( 70 , 70 , 70 , 255 ) ); 80 | hack::game::renderer::filled_rectangle ( pos + 1 , element_size - 2 , value ); 81 | 82 | if ( this->m_value_hash != m_hash ) 83 | return; 84 | 85 | const auto popup_pos = c_vector2 ( pos.x + element_size.x + 10 , pos.y ); 86 | const auto popup_size = c_vector2 ( 200 , 220 ); 87 | 88 | if ( this->m_animtime < 1.f ) 89 | this->m_animtime += globals::frametime * 2.133f; 90 | 91 | this->m_animtime = std::clamp ( this->m_animtime , 0.f , 1.f ); 92 | 93 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , popup_size * utils::ease_out_quart ( this->m_animtime ) ) ); 94 | 95 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , popup_size , c_color ( 21 , 21 , 21 , 255 ) ) ); 96 | layer_queue.push_back ( utils::draw_call_t ( popup_pos + 1 , popup_size - 2 , c_color ( 34 , 34 , 34 , 255 ) ) ); 97 | layer_queue.push_back ( utils::draw_call_t ( popup_pos + 4 , c_vector2 ( popup_size.x - 8 , popup_size.x - 8 ) , c_color ( 47 , 47 , 47 , 255 ) ) ); 98 | layer_queue.push_back ( utils::draw_call_t ( popup_pos + 5 , c_vector2 ( popup_size.x - 10 , popup_size.x - 10 ) , c_color ( 255 , 255 , 255 , 255 ) , c_color::from_hsv ( this->m_hue , 1.f , 0.5f ) , true ) ); 99 | layer_queue.push_back ( utils::draw_call_t ( popup_pos + 5 , c_vector2 ( popup_size.x - 10 , popup_size.x - 10 ) , c_color ( 0 , 0 , 0 , 0 ) , c_color ( 0 , 0 , 0 , 255 ) , false ) ); 100 | 101 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + 4 , popup_pos.y + 5 + popup_size.x - 8 ) , c_vector2 ( popup_size.x - 8 , 8 ) , c_color ( 47 , 47 , 47 , 255 ) ) ); 102 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + 5 , popup_pos.y + 5 + popup_size.x - 7 ) , c_vector2 ( 1 , 1 ) , hack::game::renderer::texture_wrappers::hue_bar_texture_wrapper , 0.742f ) ); 103 | 104 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + 4 , popup_pos.y + 5 + popup_size.x + 2 ) , c_vector2 ( popup_size.x - 8 , 8 ) , c_color ( 47 , 47 , 47 , 255 ) ) ); 105 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + 5 , popup_pos.y + 5 + popup_size.x + 3 ) , c_vector2 ( 1 , 1 ) , hack::game::renderer::texture_wrappers::transparency_bar_texture_wrapper , 0.742f ) ); 106 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_combobox.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_combobox::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | this->m_size.x = ( size.x - 44 ); 5 | } 6 | 7 | void hack::menu::controls::c_combobox::think ( const c_vector2 & pos ) { 8 | // if ( m_hash && m_hash != this->m_value_hash ) { 9 | /* handle children of our element and return */ 10 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 11 | 12 | for ( auto & child : this->m_children ) { 13 | child->think ( cursor ); 14 | cursor.x -= 35; 15 | } 16 | // } 17 | 18 | auto & value = CONFIG_GET ( int , this->m_value_hash ); 19 | 20 | value = std::clamp ( value , 0 , static_cast< int >( this->m_members.size ( ) ) ); 21 | this->m_scroll_time = std::clamp ( this->m_scroll_time , 0.f , 0.3f ); 22 | 23 | if ( m_hash && m_hash != this->m_value_hash ) 24 | return; 25 | 26 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 27 | 28 | auto thinkpos = c_vector2 ( pos.x , pos.y + text_size.y + 4 ); 29 | 30 | if ( input::key_released ( 1 ) && input::mouse_in_region ( pos.x , pos.y + text_size.y + 4 , this->m_size.x , text_size.y + 4 ) ) { 31 | m_hash = this->m_value_hash; 32 | this->m_animtime = 0.f; 33 | } 34 | 35 | if ( m_hash != this->m_value_hash ) 36 | return; 37 | 38 | if ( this->m_animtime < 1.f ) 39 | this->m_animtime += globals::frametime * 2.133f; 40 | 41 | if ( this->m_scroll_time > 0.1f ) 42 | this->m_scroll_time -= globals::frametime; 43 | 44 | const auto popup_pos = c_vector2 ( thinkpos.x , thinkpos.y + text_size.y + 10 ); 45 | const auto popup_size = c_vector2 ( this->m_size.x , ( ( text_size.y + 4 ) * std::min ( this->m_members.size ( ) , 10 ) ) + 5 ); 46 | 47 | if ( input::key_released ( 1 ) && !input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_animtime > 0.8f ) { 48 | m_hash = 0; 49 | this->m_animtime = 0.f; 50 | } 51 | 52 | /* welcome to "it's 9:29 AM , i've been up for too long". today we'll present you our latest hacky shitty fix */ 53 | if ( input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_scroll_time < 0.1f && this->m_members.size ( ) > 10 ) { 54 | if ( scroll_factor > 0 ) { 55 | this->m_scroll++; 56 | this->m_scroll_time = 0.15f; 57 | } 58 | 59 | if ( scroll_factor < 0 ) { 60 | this->m_scroll--; 61 | this->m_scroll_time = 0.15f; 62 | } 63 | 64 | this->m_scroll = std::clamp ( this->m_scroll , 0 , std::abs ( static_cast< int >( this->m_members.size ( ) - 10 ) ) ); 65 | } 66 | 67 | for ( int i = 0; i < std::min ( this->m_members.size ( ) , 10 ); i++ ) 68 | if ( input::key_released ( 1 ) && input::mouse_in_region ( popup_pos.x , popup_pos.y + 10 + ( text_size.y + 4 ) * i , popup_size.x , text_size.y ) ) 69 | value = this->m_scroll + i; 70 | } 71 | 72 | void hack::menu::controls::c_combobox::draw ( c_vector2 & pos ) { 73 | auto & value = CONFIG_GET ( int , this->m_value_hash ); 74 | 75 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 76 | 77 | hack::game::renderer::text ( pos , c_color ( 255 , 255 , 255 ) , this->m_name.data ( ) , hack::game::renderer::fonts::menu_font ); 78 | 79 | /* handle children of our element */ 80 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 81 | 82 | for ( auto & child : this->m_children ) { 83 | child->draw ( cursor ); 84 | cursor.x -= 35; 85 | } 86 | 87 | pos.y += text_size.y + 4; 88 | 89 | hack::game::renderer::filled_rectangle ( pos , c_vector2 ( this->m_size.x , text_size.y + 4 ) , c_color ( 54 , 54 , 54 , 130 ) ); 90 | hack::game::renderer::text ( c_vector2 ( pos.x + ( this->m_size.x / 2 ) , pos.y + 2 ) , c_color ( 255 , 255 , 255 ) , this->m_members.at ( value ) , hack::game::renderer::fonts::menu_font , true ); 91 | 92 | pos.y += text_size.y + 10; 93 | 94 | this->m_animtime = std::clamp ( this->m_animtime , 0.f , 1.f ); 95 | 96 | if ( m_hash == this->m_value_hash ) { 97 | const auto popup_pos = c_vector2 ( pos.x , pos.y ); 98 | const auto popup_size = c_vector2 ( this->m_size.x , ( ( text_size.y + 4 ) * std::min ( this->m_members.size ( ) , 10 ) ) + 5 ); 99 | 100 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , c_vector2 ( popup_size.x , popup_size.y * utils::ease_out_quart ( this->m_animtime ) ) ) ); 101 | 102 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , popup_size , c_color ( 47 , 47 , 47 , 255 ) ) ); 103 | 104 | for ( int i = 0; i < std::min ( this->m_members.size ( ) , 10 ); i++ ) 105 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + ( popup_size.x / 2 ) , popup_pos.y + 5 + ( text_size.y + 4 ) * i ) , true , this->m_members.at ( this->m_scroll + i ) , hack::game::renderer::fonts::menu_font , value != this->m_scroll + i ? c_color ( 255 , 255 , 255 , 255 ) : config::accent_color ) ); 106 | } 107 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_form.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_form::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | /* position is an offset from the actual parent position - i know i shouldn't hardcode it but i'm behind schedule on the cheat :( */ 5 | this->m_position = c_vector2 ( 6 , 6 ); 6 | this->m_size = c_vector2 ( size.x - 12 , 50 ); 7 | this->m_selected_tab = 0; 8 | 9 | /* init for all groupboxes */ 10 | if ( !this->m_subtabs.empty ( ) ) 11 | for ( auto & subtab : this->m_subtabs ) 12 | subtab->init ( pos , size ); 13 | } 14 | 15 | void hack::menu::controls::c_form::bind ( std::shared_ptr subtab ) { 16 | this->m_subtabs.push_back ( std::move ( subtab ) ); 17 | } 18 | 19 | void hack::menu::controls::c_form::think ( const c_vector2 & pos ) { 20 | if ( !this->m_subtabs.empty ( ) && this->m_subtabs.at ( m_selected_tab ) ) 21 | this->m_subtabs.at ( m_selected_tab )->think ( pos ); 22 | } 23 | 24 | void hack::menu::controls::c_form::draw ( const c_vector2 & pos ) { 25 | auto context_cursor = pos + m_position; 26 | 27 | hack::game::renderer::gradient_rectangle ( context_cursor , c_vector2 ( this->m_size.x , 4 ) , config::accent_color , config::secondary_color , false ); 28 | 29 | context_cursor.y += 4; 30 | 31 | hack::game::renderer::filled_rectangle ( context_cursor , c_vector2 ( this->m_size.x , 35 ) , c_color ( 42 , 42 , 42 , 255 ) ); 32 | 33 | context_cursor.y -= 4; 34 | 35 | const auto acc = c_color ( config::accent_color.r , config::accent_color.g , config::accent_color.b , 30 ); 36 | const auto sec = c_color ( config::secondary_color.r , config::secondary_color.g , config::secondary_color.b , 30 ); 37 | hack::game::renderer::gradient_rectangle ( c_vector2 ( context_cursor.x , context_cursor.y - 2 ) , c_vector2 ( this->m_size.x , 8 ) , acc , sec , false ); 38 | hack::game::renderer::gradient_rectangle ( c_vector2 ( context_cursor.x , context_cursor.y - 1 ) , c_vector2 ( this->m_size.x , 6 ) , acc , sec , false ); 39 | 40 | context_cursor.y += 10; 41 | 42 | auto subtab_list_pos = 6; 43 | 44 | auto text_size = hack::game::renderer::text_position ( STR ( "<" ) , hack::game::renderer::fonts::menu_bold_font ); 45 | 46 | hack::game::renderer::text ( c_vector2 ( context_cursor.x + subtab_list_pos , context_cursor.y ) , c_color ( 220 , 220 , 220 , 255 ) , STR ( "<" ) , hack::game::renderer::fonts::menu_bold_font ); 47 | 48 | if ( input::key_released ( 1 ) && input::mouse_in_region ( context_cursor.x + subtab_list_pos , context_cursor.y , text_size.x , text_size.y ) ) 49 | queued_tab = 0; 50 | 51 | subtab_list_pos += text_size.x + 10; 52 | 53 | auto idx = 0; 54 | 55 | for ( const auto & tab : this->m_subtabs ) { 56 | text_size = hack::game::renderer::text_position ( tab->m_name , hack::game::renderer::fonts::menu_bold_font ); 57 | 58 | hack::game::renderer::text ( c_vector2 ( context_cursor.x + subtab_list_pos , context_cursor.y ) , c_color ( 220 , 220 , 220 , 255 ) , tab->m_name , hack::game::renderer::fonts::menu_bold_font ); 59 | 60 | if ( input::key_released ( 1 ) && input::mouse_in_region ( context_cursor.x + subtab_list_pos , context_cursor.y , text_size.x , text_size.y ) ) 61 | this->m_selected_tab = idx; 62 | 63 | subtab_list_pos += text_size.x + 15; 64 | 65 | idx++; 66 | } 67 | 68 | context_cursor.y += 33; 69 | 70 | if ( !this->m_subtabs.empty ( ) && this->m_subtabs.at ( m_selected_tab ) ) 71 | this->m_subtabs.at ( m_selected_tab )->draw ( pos ); 72 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_groupbox.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_groupbox::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | auto context_cursor = pos; 5 | 6 | context_cursor.x += 6; 7 | context_cursor.y += 50; 8 | 9 | this->m_position = context_cursor; 10 | this->m_size = c_vector2 ( size.x - 12 , size.y - context_cursor.y - 20 ); 11 | 12 | for ( auto & ctrl : this->m_members ) 13 | ctrl->init ( pos , size ); 14 | } 15 | 16 | void hack::menu::controls::c_groupbox::bind ( std::shared_ptr control ) { 17 | this->m_members.push_back ( std::move ( control ) ); 18 | } 19 | 20 | void hack::menu::controls::c_groupbox::draw ( const c_vector2 & pos ) { 21 | auto context_cursor = pos + this->m_position; 22 | 23 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_bold_font ); 24 | const auto tool_size = hack::game::renderer::text_position ( this->m_tooltip , hack::game::renderer::fonts::menu_font ); 25 | 26 | hack::game::renderer::text ( c_vector2 ( context_cursor.x + 15 , context_cursor.y ) , config::accent_color , this->m_name , hack::game::renderer::fonts::menu_bold_font ); 27 | context_cursor.y += text_size.y + 2; 28 | 29 | hack::game::renderer::text ( c_vector2 ( context_cursor.x + 15 , context_cursor.y ) , config::accent_color , this->m_tooltip , hack::game::renderer::fonts::menu_font ); 30 | context_cursor.y += tool_size.y; 31 | 32 | context_cursor.y += 8; 33 | 34 | const auto acc = c_color ( config::accent_color.r , config::accent_color.g , config::accent_color.b , 30 ); 35 | const auto sec = c_color ( config::secondary_color.r , config::secondary_color.g , config::secondary_color.b , 30 ); 36 | 37 | hack::game::renderer::gradient_rectangle ( context_cursor , c_vector2 ( this->m_size.x , 4 ) , config::accent_color , config::secondary_color , false ); 38 | 39 | context_cursor.y += 4; 40 | 41 | hack::game::renderer::filled_rectangle ( context_cursor , c_vector2 ( this->m_size.x , this->m_size.y - 35 ) , c_color ( 42 , 42 , 42 , 255 ) ); 42 | 43 | context_cursor.y -= 4; 44 | 45 | hack::game::renderer::gradient_rectangle ( c_vector2 ( context_cursor.x , context_cursor.y - 2 ) , c_vector2 ( this->m_size.x , 8 ) , acc , sec , false ); 46 | hack::game::renderer::gradient_rectangle ( c_vector2 ( context_cursor.x , context_cursor.y - 1 ) , c_vector2 ( this->m_size.x , 6 ) , acc , sec , false ); 47 | 48 | context_cursor.y += 4; 49 | 50 | context_cursor.x += 16; 51 | context_cursor.y += 12; 52 | 53 | /* do clipping */ 54 | const auto old_viewport = hack::game::renderer::start_clipping ( context_cursor , c_vector2 ( this->m_size.x , this->m_size.y - 35 ) ); 55 | 56 | /* draw and think all of our children -- much easier to do here since we will manipulate the cursor vector */ 57 | for ( auto & control : this->m_members ) { 58 | control->think ( context_cursor ); 59 | control->draw ( context_cursor ); 60 | } 61 | 62 | /* undo clipping */ 63 | hack::game::renderer::end_clipping ( old_viewport ); 64 | } 65 | -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_home.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_home::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | this->m_position = c_vector2 ( 0 , 0 ); 5 | this->m_size = c_vector2 ( size.x , size.y ); 6 | 7 | this->m_selected_tab = 0; 8 | this->m_queued_tab = -1; 9 | 10 | if ( !this->m_tabs.empty ( ) ) 11 | for ( auto & groupbox : this->m_tabs ) 12 | groupbox->init ( this->m_position , size ); 13 | } 14 | 15 | void hack::menu::controls::c_home::bind ( std::shared_ptr tab ) { 16 | this->m_tabs.push_back ( std::move ( tab ) ); 17 | } 18 | 19 | void hack::menu::controls::c_home::think ( const c_vector2 & pos ) { 20 | if ( !this->m_tabs.empty ( ) && this->m_selected_tab && this->m_tabs.at ( this->m_selected_tab - 1 ) ) 21 | this->m_tabs.at ( this->m_selected_tab - 1 )->think ( pos ); 22 | } 23 | 24 | void hack::menu::controls::c_home::draw ( const c_vector2 & pos ) { 25 | if ( !this->m_selected_tab ) { 26 | const auto rect_pos = c_vector2 ( pos.x + ( this->m_size.x / 2 ) - 100 , pos.y + ( this->m_size.y / 2 ) - 75 ) , rect_size = c_vector2 ( 200 , 150 ); 27 | 28 | hack::game::renderer::gradient_rectangle ( c_vector2 ( rect_pos.x - 3 , rect_pos.y - 3 ) , c_vector2 ( rect_size.x + 6 , 1 ) , config::accent_color , config::secondary_color , false ); 29 | hack::game::renderer::gradient_rectangle ( c_vector2 ( rect_pos.x - 3 , rect_pos.y - 3 + rect_size.y + 5 ) , c_vector2 ( rect_size.x + 6 , 1 ) , config::secondary_color , config::accent_color , false ); 30 | 31 | hack::game::renderer::gradient_rectangle ( c_vector2 ( rect_pos.x - 3 + rect_size.x + 5 , rect_pos.y - 2 ) , c_vector2 ( 1 , rect_size.y + 4 ) , config::secondary_color , config::accent_color , true ); 32 | hack::game::renderer::gradient_rectangle ( c_vector2 ( rect_pos.x - 3 , rect_pos.y - 2 ) , c_vector2 ( 1 , rect_size.y + 4 ) , config::accent_color , config::secondary_color , true ); 33 | 34 | hack::game::renderer::filled_rectangle ( rect_pos - 2 , rect_size + 4 , c_color ( 37 , 37 , 37 , 255 ) ); 35 | 36 | auto text_position = c_vector2 ( pos.x + ( this->m_size.x / 2 ) , pos.y + ( this->m_size.y / 2 ) - 40 ); 37 | 38 | hack::game::renderer::text ( text_position , c_color ( 235 , 235 , 235 , 255 ) , m_name , hack::game::renderer::fonts::menu_title_font , true ); 39 | 40 | const auto title_size = hack::game::renderer::text_position ( m_name , hack::game::renderer::fonts::menu_title_font ); 41 | 42 | text_position.x -= ( title_size.x / 2 ); 43 | text_position.y += title_size.y + 15; 44 | 45 | auto scrolltab = 1; 46 | 47 | const auto developed_text_size = hack::game::renderer::text_position ( STR ( "pt" ) , hack::game::renderer::fonts::menu_font ); 48 | 49 | hack::game::renderer::text ( c_vector2 ( pos.x + ( this->m_size.x / 2 ) , pos.y + this->m_size.y - developed_text_size.y - 2 ) , c_color::from_hsv ( std::fmodf ( hack::menu::globals::realtime * 100.f , 360.f ) , 1.f , 0.75f ) , STR ( "made with love by swoopae" ) , hack::game::renderer::fonts::menu_font , true ); 50 | 51 | for ( const auto & tab : this->m_tabs ) { 52 | const auto text_size = hack::game::renderer::text_position ( tab->m_name , hack::game::renderer::fonts::menu_font ) + 1; 53 | 54 | bool hovered = false; 55 | 56 | if ( input::mouse_in_region ( text_position.x , text_position.y , text_size.x , text_size.y ) ) 57 | hovered = true; 58 | 59 | if ( input::key_released ( 1 ) && hovered ) { 60 | this->m_queued_tab = scrolltab; 61 | this->m_time_in_anim = 2.f; 62 | } 63 | 64 | hack::game::renderer::text ( text_position , hovered ? c_color ( 240 , 240 , 240 , 255 ) : c_color ( 220 , 220 , 220 , 255 ) , tab->m_name , hack::game::renderer::fonts::menu_font , false ); 65 | 66 | text_position.x += text_size.x; 67 | scrolltab++; 68 | } 69 | 70 | return; 71 | } 72 | 73 | if ( queued_tab != -1 ) { 74 | this->m_queued_tab = queued_tab; 75 | this->m_time_in_anim = 2.f; 76 | queued_tab = -1; 77 | } 78 | 79 | if ( !this->m_tabs.empty ( ) && this->m_tabs.at ( this->m_selected_tab - 1 ) ) 80 | this->m_tabs.at ( this->m_selected_tab - 1 )->draw ( pos ); 81 | } 82 | -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_keybind.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_keybind::think ( const c_vector2 & pos ) { 4 | /* if we aren't the top most element and there's some other element blocking input */ 5 | if ( this->m_value_hash != m_hash && m_hash ) 6 | return; 7 | 8 | auto & value = CONFIG_GET ( keybind_t , this->m_value_hash ); 9 | 10 | const auto text_size = hack::game::renderer::text_position ( STR ( "pt" ) , hack::game::renderer::fonts::menu_font ); 11 | const auto element_size = c_vector2 ( 30 , text_size.y ); 12 | 13 | if ( input::key_released ( 1 ) && input::mouse_in_region ( pos.x , pos.y , element_size.x , element_size.y ) ) { 14 | m_hash = this->m_value_hash; 15 | this->m_popup = false; 16 | } else if ( input::key_released ( 2 ) && input::mouse_in_region ( pos.x , pos.y , element_size.x , element_size.y ) ) { 17 | m_hash = this->m_value_hash; 18 | this->m_animtime = 0.f; 19 | this->m_popup = true; 20 | } 21 | 22 | /* if we aren't blocking input */ 23 | if ( this->m_value_hash != m_hash ) 24 | return; 25 | 26 | if ( this->m_popup ) { 27 | const auto popup_pos = c_vector2 ( pos.x + element_size.x + 10 , pos.y ); 28 | const auto popup_size = c_vector2 ( 50 , 50 ); 29 | 30 | if ( input::key_released ( 1 ) && !input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_animtime > 0.8f ) { 31 | m_hash = 0; 32 | this->m_animtime = 0.f; 33 | 34 | return; 35 | } 36 | 37 | if ( input::key_released ( 1 ) && input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_animtime > 0.8f ) { 38 | if ( input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , 17 ) ) 39 | value.m_type = 0; 40 | if ( input::mouse_in_region ( popup_pos.x , popup_pos.y + 17 , popup_size.x , 17 ) ) 41 | value.m_type = 1; 42 | if ( input::mouse_in_region ( popup_pos.x , popup_pos.y + 34 , popup_size.x , 17 ) ) 43 | value.m_type = 2; 44 | } 45 | } else { 46 | for ( auto i = 1; i < 256; i++ ) { 47 | if ( input::key_pressed ( i ) && fnv1a_rt ( utils::keys_list [ i ].data ( ) ) != fnv1a ( "error" ) ) { 48 | value.m_key = i; 49 | m_hash = 0; 50 | } 51 | } 52 | } 53 | } 54 | 55 | void hack::menu::controls::c_keybind::draw ( const c_vector2 & pos ) { 56 | const auto text_size = hack::game::renderer::text_position ( STR ( "pt" ) , hack::game::renderer::fonts::menu_font ); 57 | 58 | auto & value = CONFIG_GET ( keybind_t , this->m_value_hash ); 59 | 60 | const auto element_size = c_vector2 ( 30 , text_size.y ); 61 | 62 | hack::game::renderer::filled_rectangle ( pos , element_size , c_color ( 70 , 70 , 70 , 255 ) ); 63 | 64 | hack::game::renderer::text ( c_vector2 ( pos.x + element_size.x / 2 , pos.y ) , c_color ( 255 , 255 , 255 , 255 ) , ( this->m_value_hash == m_hash && !this->m_popup ) ? STR ( ". . ." ) : utils::keys_list [ value.m_key ] , hack::game::renderer::fonts::menu_font , true ); 65 | 66 | if ( this->m_value_hash != m_hash ) 67 | return; 68 | 69 | const auto popup_pos = c_vector2 ( pos.x + element_size.x + 10 , pos.y ); 70 | const auto popup_size = c_vector2 ( 50 , 50 ); 71 | 72 | if ( this->m_animtime < 1.f && this->m_popup ) 73 | this->m_animtime += globals::frametime * 2.133f; 74 | 75 | this->m_animtime = std::clamp ( this->m_animtime , 0.f , 1.f ); 76 | 77 | if ( !this->m_popup ) 78 | return; 79 | 80 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , c_vector2 ( popup_size.x , popup_size.y * utils::ease_out_quart ( this->m_animtime ) ) ) ); 81 | 82 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , popup_size , c_color ( 47 , 47 , 47 , 255 ) ) ); 83 | 84 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + ( popup_size.x / 2 ) , popup_pos.y + 2 ) , true , STR ( "ignore" ) , hack::game::renderer::fonts::menu_font , value.m_type ? c_color ( 255 , 255 , 255 , 255 ) : config::accent_color ) ); 85 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + ( popup_size.x / 2 ) , popup_pos.y + 16 ) , true , STR ( "toggle" ) , hack::game::renderer::fonts::menu_font , value.m_type != 1 ? c_color ( 255 , 255 , 255 , 255 ) : config::accent_color ) ); 86 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + ( popup_size.x / 2 ) , popup_pos.y + 30 ) , true , STR ( "hold" ) , hack::game::renderer::fonts::menu_font , value.m_type != 2 ? c_color ( 255 , 255 , 255 , 255 ) : config::accent_color ) ); 87 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_multicombobox.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_multicombobox::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | this->m_size.x = ( size.x - 44 ); 5 | } 6 | 7 | void hack::menu::controls::c_multicombobox::think ( const c_vector2 & pos ) { 8 | // if ( m_hash && m_hash != this->m_value_hash ) { 9 | /* handle children of our element and return */ 10 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 11 | 12 | for ( auto & child : this->m_children ) { 13 | child->think ( cursor ); 14 | cursor.x -= 35; 15 | } 16 | // } 17 | this->m_scroll_time = std::clamp ( this->m_scroll_time , 0.f , 0.3f ); 18 | 19 | if ( m_hash && m_hash != this->m_value_hash ) 20 | return; 21 | 22 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 23 | 24 | auto thinkpos = c_vector2 ( pos.x , pos.y + text_size.y + 4 ); 25 | 26 | if ( input::key_released ( 1 ) && input::mouse_in_region ( pos.x , pos.y + text_size.y + 4 , this->m_size.x , text_size.y + 4 ) ) { 27 | m_hash = this->m_value_hash; 28 | this->m_animtime = 0.f; 29 | } 30 | 31 | if ( m_hash != this->m_value_hash ) 32 | return; 33 | 34 | if ( this->m_animtime < 1.f ) 35 | this->m_animtime += globals::frametime * 2.133f; 36 | 37 | if ( this->m_scroll_time > 0.1f ) 38 | this->m_scroll_time -= globals::frametime; 39 | 40 | const auto popup_pos = c_vector2 ( thinkpos.x , thinkpos.y + text_size.y + 10 ); 41 | const auto popup_size = c_vector2 ( this->m_size.x , ( ( text_size.y + 4 ) * std::min ( this->m_members.size ( ) , 10 ) ) + 5 ); 42 | 43 | if ( input::key_released ( 1 ) && !input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_animtime > 0.8f ) { 44 | m_hash = 0; 45 | this->m_animtime = 0.f; 46 | } 47 | 48 | /* welcome to "it's 9:29 AM , i've been up for too long". today we'll present you our latest hacky shitty fix */ 49 | if ( input::mouse_in_region ( popup_pos.x , popup_pos.y , popup_size.x , popup_size.y ) && this->m_scroll_time < 0.1f && this->m_members.size ( ) > 10 ) { 50 | if ( scroll_factor > 0 ) { 51 | this->m_scroll++; 52 | this->m_scroll_time = 0.15f; 53 | } 54 | 55 | if ( scroll_factor < 0 ) { 56 | this->m_scroll--; 57 | this->m_scroll_time = 0.15f; 58 | } 59 | 60 | this->m_scroll = std::clamp ( this->m_scroll , 0 , std::abs ( static_cast< int >( this->m_members.size ( ) - 10 ) ) ); 61 | } 62 | 63 | for ( int i = 0; i < std::min ( this->m_members.size ( ) , 10 ); i++ ) { 64 | if ( input::key_released ( 1 ) && input::mouse_in_region ( popup_pos.x , popup_pos.y + 10 + ( text_size.y + 4 ) * i , popup_size.x , text_size.y ) ) { 65 | auto & value = CONFIG_GET ( bool , this->m_hashes.at ( this->m_scroll + i ) ); 66 | 67 | value = !value; 68 | } 69 | } 70 | } 71 | 72 | void hack::menu::controls::c_multicombobox::draw ( c_vector2 & pos ) { 73 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 74 | 75 | hack::game::renderer::text ( pos , c_color ( 255 , 255 , 255 ) , this->m_name.data ( ) , hack::game::renderer::fonts::menu_font ); 76 | 77 | /* handle children of our element */ 78 | c_vector2 cursor ( pos.x + this->m_size.x - 33 , pos.y ); 79 | 80 | for ( auto & child : this->m_children ) { 81 | child->draw ( cursor ); 82 | cursor.x -= 35; 83 | } 84 | 85 | pos.y += text_size.y + 4; 86 | 87 | std::string str = STR ( "none" ); 88 | bool first = true; 89 | 90 | for ( int i = 0; i < this->m_members.size ( ); i++ ) { 91 | auto & value = CONFIG_GET ( bool , this->m_hashes.at ( i ) ); 92 | 93 | if ( value ) { 94 | if ( first ) { 95 | str = this->m_members.at ( i ); 96 | first = false; 97 | } else { 98 | str.append ( STR ( ", " ) ); 99 | str.append ( this->m_members.at ( i ) ); 100 | } 101 | } 102 | } 103 | 104 | hack::game::renderer::filled_rectangle ( pos , c_vector2 ( this->m_size.x , text_size.y + 4 ) , c_color ( 54 , 54 , 54 , 130 ) ); 105 | hack::game::renderer::text ( c_vector2 ( pos.x + ( this->m_size.x / 2 ) , pos.y + 2 ) , c_color ( 255 , 255 , 255 ) , str , hack::game::renderer::fonts::menu_font , true ); 106 | 107 | pos.y += text_size.y + 10; 108 | 109 | this->m_animtime = std::clamp ( this->m_animtime , 0.f , 1.f ); 110 | 111 | if ( m_hash == this->m_value_hash ) { 112 | const auto popup_pos = c_vector2 ( pos.x , pos.y ); 113 | const auto popup_size = c_vector2 ( this->m_size.x , ( ( text_size.y + 4 ) * std::min ( this->m_members.size ( ) , 10 ) ) + 5 ); 114 | 115 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , c_vector2 ( popup_size.x , popup_size.y * utils::ease_out_quart ( this->m_animtime ) ) ) ); 116 | 117 | layer_queue.push_back ( utils::draw_call_t ( popup_pos , popup_size , c_color ( 47 , 47 , 47 , 255 ) ) ); 118 | 119 | for ( int i = 0; i < std::min ( this->m_members.size ( ) , 10 ); i++ ) { 120 | auto& value = CONFIG_GET ( bool , this->m_hashes.at ( this->m_scroll + i ) ); 121 | 122 | layer_queue.push_back ( utils::draw_call_t ( c_vector2 ( popup_pos.x + ( popup_size.x / 2 ) , popup_pos.y + 5 + ( text_size.y + 4 ) * i ) , true , this->m_members.at ( this->m_scroll + i ) , hack::game::renderer::fonts::menu_font , !value ? c_color ( 255 , 255 , 255 , 255 ) : config::accent_color ) ); 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_slider.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_slider::init ( const c_vector2 & pos , const c_vector2 & size ) { 4 | this->m_size.x = ( size.x - 44 ); 5 | } 6 | 7 | void hack::menu::controls::c_slider::think ( const c_vector2 & pos ) { 8 | if ( m_hash && m_hash != this->m_value_hash ) 9 | return; 10 | 11 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 12 | 13 | auto & value = CONFIG_GET ( int , this->m_value_hash ); 14 | 15 | if ( input::key_down ( 1 ) && input::mouse_in_region ( pos.x , pos.y + text_size.y + 4 , this->m_size.x + 2 , 6 ) ) { 16 | const int value_unmapped = std::clamp ( static_cast< int >( input::mouse_pos.x - pos.x ) , 0 , static_cast< int >( this->m_size.x ) ); 17 | const int value_mapped = static_cast< int >( value_unmapped / this->m_size.x * ( this->m_max - this->m_min ) + this->m_min ); 18 | 19 | value = std::clamp ( value_mapped , this->m_min , this->m_max ); 20 | } 21 | } 22 | 23 | void hack::menu::controls::c_slider::draw ( c_vector2 & pos ) { 24 | auto & value = CONFIG_GET ( int , this->m_value_hash ); 25 | 26 | const auto text_size = hack::game::renderer::text_position ( this->m_name , hack::game::renderer::fonts::menu_font ); 27 | const int dynamic_width = ( static_cast< float >( value ) - this->m_min ) / ( this->m_max - this->m_min ) * this->m_size.x; 28 | 29 | /* do clipping */ 30 | // const auto old_viewport = hack::game::renderer::start_clipping ( pos , c_vector2 ( text_size.y , text_size.y ) ); 31 | 32 | /* undo clipping */ 33 | // hack::game::renderer::end_clipping ( old_viewport ); 34 | 35 | hack::game::renderer::text ( pos , c_color ( 255 , 255 , 255 ) , std::string ( this->m_name + STR ( ": " ) ).data ( ) , hack::game::renderer::fonts::menu_font ); 36 | hack::game::renderer::text ( c_vector2 ( pos.x + text_size.x + 6 , pos.y ) , c_color ( 255 , 255 , 255 ) , std::to_string ( value ) , hack::game::renderer::fonts::menu_font ); 37 | 38 | pos.y += text_size.y + 4; 39 | 40 | hack::game::renderer::filled_rectangle ( pos , c_vector2 ( this->m_size.x , 6 ) , c_color ( 54 , 54 , 54 , 130 ) ); 41 | hack::game::renderer::filled_rectangle ( pos , c_vector2 ( dynamic_width , 6 ) , c_color ( 70 , 70 , 70 , 255 ) ); 42 | 43 | pos.y += 12; 44 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/menu/controls/c_window.cc: -------------------------------------------------------------------------------- 1 | #include "../framework.hh" 2 | 3 | void hack::menu::controls::c_window::init ( const c_vector2 & size , const c_vector2 & position ) { 4 | this->m_position = position; 5 | this->m_size = size; 6 | this->m_on_top = false; 7 | this->m_is_dragging = false; 8 | 9 | if ( this->m_home_obj ) 10 | this->m_home_obj->init ( this->m_position , this->m_size ); 11 | } 12 | 13 | void hack::menu::controls::c_window::bind ( std::shared_ptr form ) { 14 | this->m_home_obj.swap ( form ); 15 | } 16 | 17 | void hack::menu::controls::c_window::think ( ) { 18 | /* for multiple window support */ 19 | if ( input::key_pressed ( 1 ) && input::mouse_in_region ( this->m_position.x , this->m_position.y , this->m_size.x , this->m_size.y ) ) 20 | this->m_on_top = true; 21 | 22 | /* don't think is this isn't the window on top */ 23 | if ( !this->m_on_top ) 24 | return; 25 | 26 | /* handle window dragging only if it was on top for more than this tick */ 27 | if ( input::mouse_in_region ( this->m_position.x , this->m_position.y , this->m_size.x , 15 ) ) { 28 | this->m_is_dragging = true; 29 | } else if ( input::key_down ( 1 ) && this->m_is_dragging ) { 30 | this->m_position.x += input::mouse_pos.x - input::prev_mouse_pos.x; 31 | this->m_position.y += input::mouse_pos.y - input::prev_mouse_pos.y; 32 | } else if ( !input::key_down ( 1 ) && this->m_is_dragging ) { 33 | this->m_is_dragging = false; 34 | } 35 | 36 | /* think for selected form */ 37 | this->m_home_obj->think ( this->m_position ); 38 | 39 | /* make sure window doesn't go out of bounds */ 40 | /* RETARD ALERT: GAME SPECIFIC CODE! */ 41 | int width , height; 42 | hack::game::interfaces::engine->get_screen_size ( width , height ); 43 | 44 | this->m_position.x = std::clamp ( this->m_position.x , 0.f , width - this->m_size.x ); 45 | this->m_position.y = std::clamp ( this->m_position.y , 0.f , height - this->m_size.y ); 46 | } 47 | 48 | void hack::menu::controls::c_window::draw ( ) { 49 | /* main window */ 50 | /* outside border */ 51 | hack::game::renderer::filled_rectangle ( this->m_position - 4 , this->m_size + 8 , c_color ( 0 , 0 , 0 , 30 ) ); 52 | 53 | /* gradient border */ 54 | hack::game::renderer::gradient_rectangle ( c_vector2 ( this->m_position.x - 3 , this->m_position.y - 3 ) , c_vector2 ( this->m_size.x + 6 , 1 ) , config::accent_color , config::secondary_color , false ); 55 | hack::game::renderer::gradient_rectangle ( c_vector2 ( this->m_position.x - 3 , this->m_position.y - 3 + this->m_size.y + 5 ) , c_vector2 ( this->m_size.x + 6 , 1 ) , config::secondary_color , config::accent_color , false ); 56 | 57 | hack::game::renderer::gradient_rectangle ( c_vector2 ( this->m_position.x - 3 + this->m_size.x + 5 , this->m_position.y - 2 ) , c_vector2 ( 1 , this->m_size.y + 4 ) , config::secondary_color , config::accent_color , true ); 58 | hack::game::renderer::gradient_rectangle ( c_vector2 ( this->m_position.x - 3 , this->m_position.y - 2 ) , c_vector2 ( 1 , this->m_size.y + 4 ) , config::accent_color , config::secondary_color , true ); 59 | 60 | /* actual menu frame */ 61 | hack::game::renderer::filled_rectangle ( this->m_position - 1 , this->m_size + 2 , c_color ( 21 , 21 , 21 , 255 ) ); 62 | hack::game::renderer::filled_rectangle ( this->m_position , this->m_size , c_color ( 34 , 34 , 34 , 255 ) ); 63 | 64 | /* title text, other borders etc. */ 65 | // hack::game::renderer::text ( c_vector2 ( this->m_position.x + ( this->m_size.x / 2 ) , this->m_position.y ) , c_color ( 255 , 255 , 255 , 255 ) , this->m_name.data ( ) , hack::game::renderer::fonts::menu_title_font , true ); 66 | 67 | /* do clipping */ 68 | this->m_old_viewport = hack::game::renderer::start_clipping ( this->m_position , this->m_size ); 69 | 70 | /* draw for selected form */ 71 | this->m_home_obj->draw ( this->m_position ); 72 | 73 | /* handle animations */ 74 | /* GHETTO CODE ! ! ! */ 75 | if ( this->m_home_obj->m_time_in_anim < 0.0f ) { 76 | this->m_home_obj->m_queued_tab = 0; 77 | } else if ( this->m_home_obj->m_time_in_anim < 1.f ) { 78 | if ( this->m_home_obj->m_queued_tab != -1 ) { 79 | this->m_home_obj->m_selected_tab = this->m_home_obj->m_queued_tab; 80 | this->m_home_obj->m_queued_tab = -1; 81 | } 82 | 83 | hack::game::renderer::filled_rectangle ( this->m_position , this->m_size , c_color ( 43 , 43 , 43 , 255 * utils::ease_in_quart ( this->m_home_obj->m_time_in_anim ) ) ); 84 | } else { 85 | const auto factor = std::fabsf ( 1.f - ( this->m_home_obj->m_time_in_anim - 1.f ) ); 86 | const auto draw_pos = c_vector2 ( this->m_position.x + ( this->m_size.x / 2 ) , this->m_position.y + ( this->m_size.y / 2 ) ); 87 | 88 | hack::game::renderer::filled_circle ( draw_pos , this->m_size.x * factor , 180 , c_color ( 43 , 43 , 43 , 255 ) ); 89 | } 90 | 91 | if ( this->m_home_obj->m_time_in_anim > 0.0f ) 92 | this->m_home_obj->m_time_in_anim -= globals::frametime; 93 | 94 | this->m_home_obj->m_time_in_anim = std::clamp ( this->m_home_obj->m_time_in_anim , 0.f , 2.f ); 95 | 96 | /* do layer drawing */ 97 | if ( !layer_queue.empty ( ) ) { 98 | for ( const auto & element : layer_queue ) { 99 | switch ( element.m_type ) { 100 | case utils::e_draw_types::DRAW_FILLED: 101 | hack::game::renderer::filled_rectangle ( element.m_pos , element.m_size , element.m_acc ); 102 | break; 103 | case utils::e_draw_types::DRAW_RECT: 104 | hack::game::renderer::filled_rectangle ( c_vector2 ( element.m_pos.x , element.m_pos.y ) , c_vector2 ( element.m_size.x , element.m_size.y ) , element.m_acc ); 105 | break; 106 | case utils::e_draw_types::DRAW_TEXTURE: 107 | hack::game::renderer::image ( element.m_pos , element.m_size , element.m_wrapper , element.m_scale ); 108 | break; 109 | case utils::e_draw_types::DRAW_GRADIENT: 110 | hack::game::renderer::gradient_rectangle ( element.m_pos , element.m_size , element.m_acc , element.m_sec , !element.m_horizontal ); 111 | break; 112 | case utils::e_draw_types::DRAW_TEXT: 113 | hack::game::renderer::text ( element.m_pos , element.m_acc , element.m_text , element.m_font , element.m_centered ); 114 | break; 115 | case utils::e_draw_types::UTIL_SETCLIPPING: 116 | hack::game::renderer::start_clipping ( element.m_pos , element.m_size ); 117 | break; 118 | } 119 | } 120 | } 121 | 122 | /* empty queue for other windows to use */ 123 | layer_queue.clear ( ); 124 | 125 | /* undo clipping */ 126 | hack::game::renderer::end_clipping ( this->m_old_viewport ); 127 | } 128 | -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/animations/animations.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include 7 | #include 8 | 9 | namespace hack::modules::animations { 10 | /* last resolver state */ 11 | enum e_resolver_state : unsigned char { 12 | resolver_auto = 0 , 13 | resolver_forced_direction , 14 | resolver_anti_freestanding , 15 | resolver_bruteforce_stage_one , 16 | resolver_bruteforce_stage_two , 17 | resolver_bruteforce_stage_three , 18 | resolver_bruteforce_stage_four , 19 | resolver_unknown 20 | }; 21 | 22 | enum e_resolver_side : unsigned char { 23 | side_auto = 0 , 24 | side_left , 25 | side_right , 26 | side_force_backwards , 27 | side_unknown 28 | }; 29 | 30 | /* animation frame / tick */ 31 | struct anim_frame_t { 32 | void store ( sdk::c_player * player ); 33 | void apply ( sdk::c_player * player ); 34 | void update ( sdk::c_player * player , anim_frame_t * previous = nullptr , int choked = 0 ); 35 | 36 | c_vector3 m_origin , m_velocity , m_angs , m_mins , m_maxs , m_absangs; 37 | float m_simulation_time , m_duck , m_shot; 38 | int m_flags , m_eflags; 39 | sdk::animstate_t m_animstate; 40 | std::array m_poses; 41 | std::array m_overlays; 42 | bool m_shot_record; 43 | 44 | c_matrix3x4 m_bones [ 128 ]; 45 | c_matrix3x4 m_resolved_bones [ 128 ]; /* for safepoint */ 46 | }; 47 | 48 | /* every player should have one of these , based on their handle ( except for local ) */ 49 | struct anim_info_t { 50 | /* animation frames */ 51 | std::deque m_recieved_frames; 52 | 53 | /* animation fix related info */ 54 | sdk::c_player * m_player; 55 | float m_spawntime; 56 | int m_last_choked; /* for resolver check */ 57 | 58 | /* player handle -- needed to check if we should invalidate all records */ 59 | std::uint32_t m_handle; 60 | 61 | /* resolver info */ 62 | bool m_should_resolve; /* we shouldn't resolve bots / legits */ 63 | std::uint8_t m_missed_shots; /* only counting missed shots due to incorrect resolve */ 64 | e_resolver_state m_last_resolver_state; 65 | e_resolver_side m_resolved_side; 66 | }; 67 | 68 | /* just to make sure everything here is allocated where its supposed to be */ 69 | class c_animationsystem { 70 | public: 71 | std::array m_animation_info; 72 | std::vector>> m_local_cmds; 73 | }; 74 | 75 | inline std::unique_ptr animation_system = std::make_unique ( ); 76 | 77 | inline bool allow_clientside_anims = false , allow_setup_bones = false , in_local_animfix = false; 78 | inline c_matrix3x4 local_real_bones [ 128 ] , local_desync_bones [ 128 ]; 79 | inline bool new_tick = false; 80 | inline float last_sent_absyaw = 0.f; 81 | inline c_vector3 last_origin; 82 | inline bool got_layers = false; 83 | inline bool prediction_issue = false; 84 | inline c_vector3* local_bones_pos; 85 | inline __declspec( align( 16 ) ) c_quaternion* local_bones_quat; 86 | 87 | inline pose_params networked_poses; 88 | inline sdk::animlayer_t old_layers [ 15 ] {}; 89 | 90 | void build_custom_matrix ( sdk::c_player * player , c_matrix3x4 * m , std::uint32_t max , std::uint32_t mask , float time ); 91 | void in_createmove ( ); 92 | void in_framestagenotify ( int stage ); 93 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/misc/movement.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include 7 | 8 | namespace hack::modules::misc::movement { 9 | enum class e_selfpeek_states { 10 | STATE_REST = 0, 11 | STATE_PEEKING, 12 | STATE_RETURNING, 13 | STATE_MAX 14 | }; 15 | 16 | struct peekcmd_t { 17 | float m_yaw , m_fmove , m_smove; 18 | }; 19 | 20 | inline c_vector3 last_selfpeek_origin; 21 | inline e_selfpeek_states selfpeek_state; 22 | inline bool m_selfpeek_keybind_state; 23 | 24 | void in_createmove ( ); 25 | void in_prediction ( ); 26 | void in_endscene ( ); 27 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/misc/others.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include "../../../sdk/weapon.hh" 7 | 8 | #include 9 | #include 10 | 11 | namespace hack::modules::misc::others { 12 | inline bool thirdperson_key = false; 13 | inline std::array , 65> weapon_name; 14 | 15 | void in_endscene ( ); 16 | void in_createmove ( ); 17 | void in_fsn ( int stage ); 18 | void in_overrideview ( sdk::valve::c_viewsetup * setup ); 19 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/prediction/engine_prediction.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include 7 | #include 8 | 9 | namespace hack::modules::prediction::engine_prediction { 10 | inline int * random_prediction_seed , * set_prediction_seed; 11 | inline float old_curtime , old_frametime; 12 | inline sdk::valve::movedata_t old_movedata; 13 | 14 | inline float correct_tickbase , correct_curtime; 15 | inline sdk::valve::ucmd_t * last_command; 16 | 17 | /* pretty sure weapon accuracypenalty also gets affected... ~swoopae */ 18 | struct player_data_t { 19 | c_vector3 m_aimpunch , m_aimpunchvelocity , m_viewoffset , m_viewpunch , m_velocity , m_velocitybase; 20 | float m_duckamount , m_duckspeed , m_velocitymodifier , m_fallvelocity; 21 | int m_tickbase; 22 | }; 23 | 24 | void start_prediction ( ); 25 | void end_prediction ( ); 26 | void repredict ( ); 27 | void update_correct_globals ( ); 28 | 29 | inline std::array data; 30 | inline bool in_custom_prediction; 31 | 32 | void store_netvars ( ); 33 | void apply_netvars ( ); 34 | 35 | void run_in_prediction ( std::function< void ( ) > fn ); 36 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/rage/antiaim.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include 7 | 8 | namespace hack::modules::rage::antiaim { 9 | inline bool aa_desync_invert_keystate = false , rage_fakeduck_keystate = false; 10 | inline c_vector3 last_sent_angles , last_choked_angles , last_shot_angles; 11 | 12 | void in_movement_fix ( std::function fn ); 13 | void in_prediction ( ); 14 | void in_endscene ( ); 15 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/rage/autowall.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include "../../../sdk/weapon.hh" 7 | 8 | #include 9 | 10 | namespace hack::modules::rage::autowall { 11 | struct wall_pen_t { 12 | float m_damage; 13 | sdk::hitboxes m_hitbox; 14 | int32_t m_hitgroup; 15 | }; 16 | 17 | void trace_line ( const c_vector3 & start , const c_vector3 & end , std::uint32_t mask , sdk::c_player * ignore , sdk::valve::c_trace * trace_pointer ); 18 | bool trace_to_exit ( sdk::valve::c_trace & enter_trace , sdk::valve::c_trace & exit_trace , const c_vector3 & start , const c_vector3 & view_direction ); 19 | float scale_damage ( sdk::c_player * target , float damage , float weapon_armor_ratio , int hitgroup , bool is_zeus ); 20 | bool handle_bullet_penetration ( sdk::c_weaponinfo * data , sdk::valve::c_trace & enter_trace , 21 | c_vector3 & eye_position , const c_vector3 & direction , int & penetrate_count , 22 | float & current_damage , float penetration_power ); 23 | wall_pen_t fire_bullet ( sdk::c_weaponinfo * data , c_vector3 & src , 24 | const c_vector3 & pos , sdk::valve::c_trace_filter * filter , 25 | sdk::c_player * target = nullptr , bool point = false , bool is_zeus = false ); 26 | 27 | wall_pen_t run_autowall ( c_vector3 shoot_position , const c_vector3 & aimpos , sdk::c_player * target , sdk::c_player * override_player = nullptr ); 28 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/rage/ragebot.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include "../../../sdk/weapon.hh" 7 | 8 | #include 9 | #include 10 | 11 | namespace hack::modules::rage::ragebot { 12 | void in_prediction ( ); 13 | void in_endscene ( ); 14 | 15 | /* 0 - autosniper , 1 - scout , 2 - awp , 3 - deag/r8 , 4 - pistols , 5 - others */ 16 | inline std::array missed_shots_by_weapon; 17 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/rage/tickbase.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include "../../../sdk/weapon.hh" 7 | 8 | #include 9 | #include 10 | 11 | namespace hack::modules::rage::tickbase { 12 | bool in_clmove ( ); 13 | void in_createmove ( ); 14 | void in_endscene ( ); 15 | bool in_writeucmddelta ( void * ecx , void * edx , int slot , void * buf , int from , int to , bool newcmd ); 16 | 17 | inline sdk::valve::ucmd_t shifted_cmd; 18 | inline int tickbase_shift = 0 , shift_amount = 0 , original_tickbase = 0; 19 | inline bool tickbase_key_state = false , can_we_dt_again = true , did_just_dt = false , force_sendpacket = false; 20 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/visuals/esp.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include 7 | 8 | namespace hack::modules::visuals::esp { 9 | struct esp_info_t { 10 | c_vector2 m_pos , m_size; 11 | sdk::c_player * m_player; 12 | bool m_dormant; 13 | }; 14 | 15 | void in_endscene ( ); 16 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/visuals/misc.cc: -------------------------------------------------------------------------------- 1 | #include "misc.hh" 2 | 3 | #include "../../game/renderer.hh" 4 | 5 | #include "../rage/tickbase.hh" 6 | #include "../rage/antiaim.hh" 7 | #include "../misc/movement.hh" 8 | #include "../animations/animations.hh" 9 | 10 | #include "../../menu/config.hh" 11 | #include "../../menu/framework.hh" 12 | 13 | #include 14 | 15 | void indicators ( ) { 16 | /* sanity checks */ 17 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::globals::local || !hack::game::globals::local->alive ( ) ) 18 | return; 19 | 20 | /* grab screen bounds */ 21 | int screen_width , screen_height; 22 | hack::game::interfaces::engine->get_screen_size ( screen_width , screen_height ); 23 | 24 | /* set initial drawing position */ 25 | screen_width /= 2; 26 | screen_height /= 2; 27 | 28 | screen_height += 25; 29 | 30 | /* start drawing indicators */ 31 | const auto & r_tickbasemanip = CONFIG_GET ( bool , fnv1a ( "r_tickbasemanip" ) ); 32 | const auto & rage_fakeduck = CONFIG_GET ( bool , fnv1a ( "rage_fakeduck" ) ); 33 | const auto & aa_desync = CONFIG_GET ( bool , fnv1a ( "aa_desync" ) ); 34 | const auto & m_selfpeek = CONFIG_GET ( bool , fnv1a ( "m_selfpeek" ) ); 35 | 36 | /* initialize our indicator colors */ 37 | const auto off_indicator_color = c_color ( 255 , 35 , 35 ) , on_indicator_color = c_color ( 35 , 255 , 35 ) , mid_indicator_color = c_color ( 255 , 255 , 35 ) , outline_color = c_color ( 0 , 0 , 0 , 240 ); 38 | 39 | if ( r_tickbasemanip ) { 40 | hack::game::renderer::text ( c_vector2 ( screen_width - 1 , screen_height - 1 ) , outline_color , STR ( "TICKBASE" ) , hack::game::renderer::fonts::menu_font , true ); 41 | 42 | if ( hack::modules::rage::tickbase::can_we_dt_again && hack::modules::rage::tickbase::tickbase_key_state ) { 43 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , on_indicator_color , STR ( "TICKBASE" ) , hack::game::renderer::fonts::menu_font , true ); 44 | } else if ( hack::modules::rage::tickbase::shift_amount > 0 ) { 45 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , mid_indicator_color , STR ( "TICKBASE" ) , hack::game::renderer::fonts::menu_font , true ); 46 | } else { 47 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , off_indicator_color , STR ( "TICKBASE" ) , hack::game::renderer::fonts::menu_font , true ); 48 | } 49 | 50 | screen_height += 16; 51 | } 52 | 53 | if ( rage_fakeduck ) { 54 | hack::game::renderer::text ( c_vector2 ( screen_width - 1 , screen_height - 1 ) , outline_color , STR ( "FAKEDUCK" ) , hack::game::renderer::fonts::menu_font , true ); 55 | 56 | if ( hack::modules::rage::antiaim::rage_fakeduck_keystate ) { 57 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , on_indicator_color , STR ( "FAKEDUCK" ) , hack::game::renderer::fonts::menu_font , true ); 58 | } else { 59 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , off_indicator_color , STR ( "FAKEDUCK" ) , hack::game::renderer::fonts::menu_font , true ); 60 | } 61 | 62 | screen_height += 16; 63 | } 64 | 65 | if ( aa_desync ) { 66 | hack::game::renderer::text ( c_vector2 ( screen_width - 1 , screen_height - 1 ) , outline_color , STR ( "INVERT" ) , hack::game::renderer::fonts::menu_font , true ); 67 | 68 | if ( hack::modules::rage::antiaim::aa_desync_invert_keystate ) { 69 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , on_indicator_color , STR ( "INVERT" ) , hack::game::renderer::fonts::menu_font , true ); 70 | } else { 71 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , off_indicator_color , STR ( "INVERT" ) , hack::game::renderer::fonts::menu_font , true ); 72 | } 73 | 74 | screen_height += 16; 75 | } 76 | 77 | if ( m_selfpeek ) { 78 | hack::game::renderer::text ( c_vector2 ( screen_width - 1 , screen_height - 1 ) , outline_color , STR ( "SELFPEEK" ) , hack::game::renderer::fonts::menu_font , true ); 79 | 80 | if ( hack::modules::misc::movement::m_selfpeek_keybind_state ) { 81 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , on_indicator_color , STR ( "SELFPEEK" ) , hack::game::renderer::fonts::menu_font , true ); 82 | } else { 83 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , off_indicator_color , STR ( "SELFPEEK" ) , hack::game::renderer::fonts::menu_font , true ); 84 | } 85 | 86 | screen_height += 16; 87 | } 88 | 89 | /* always on CHOKE indicator */ { 90 | hack::game::renderer::text ( c_vector2 ( screen_width - 1 , screen_height - 1 ) , outline_color , STR ( "CHOKE" ) , hack::game::renderer::fonts::menu_font , true ); 91 | 92 | if ( hack::game::interfaces::clientstate->choked_commands ) { 93 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , on_indicator_color , STR ( "CHOKE" ) , hack::game::renderer::fonts::menu_font , true ); 94 | } else { 95 | hack::game::renderer::text ( c_vector2 ( screen_width , screen_height ) , off_indicator_color , STR ( "CHOKE" ) , hack::game::renderer::fonts::menu_font , true ); 96 | } 97 | 98 | screen_height += 16; 99 | } 100 | } 101 | 102 | void draw_local_info ( ) { 103 | /* sanity checks */ 104 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::globals::local || !hack::game::globals::local->alive ( ) ) 105 | return; 106 | 107 | auto mata = c_color ( 255 , 255 , 255 ); 108 | int maaaaa = 15; 109 | hack::game::renderer::text ( c_vector2 ( 45 , maaaaa ) , mata , STR ( "local info" ) , hack::game::renderer::fonts::menu_font , false ); 110 | maaaaa += 15; 111 | 112 | for ( const auto & value : hack::game::globals::local->pose_parameter ( ) ) { 113 | hack::game::renderer::text ( c_vector2 ( 45 , maaaaa ) , mata , std::to_string ( value ) , hack::game::renderer::fonts::menu_font , false ); 114 | maaaaa += 15; 115 | } 116 | 117 | maaaaa = 15; 118 | 119 | for ( int i = 0; i < hack::game::globals::local->num_anim_overlays(); i++ ) { 120 | hack::game::renderer::text ( c_vector2 ( 600 , maaaaa ) , mata , std::to_string ( hack::game::globals::local->anim_overlays ( ) [ i ].m_cycle ) , hack::game::renderer::fonts::menu_font , false ); 121 | maaaaa += 15; 122 | hack::game::renderer::text ( c_vector2 ( 600 , maaaaa ) , mata , std::to_string ( hack::game::globals::local->anim_overlays ( ) [ i ].m_playback_rate ) , hack::game::renderer::fonts::menu_font , false ); 123 | maaaaa += 15; 124 | } 125 | } 126 | 127 | void custom_rain ( ) { /* nope */ } 128 | 129 | void hack::modules::visuals::misc::in_endscene ( ) { 130 | /* sanity checks */ 131 | if ( !hack::game::interfaces::engine->is_in_game ( ) || !hack::game::globals::local ) 132 | return; 133 | 134 | const auto & fx_indicators = CONFIG_GET ( bool , fnv1a ( "fx_indicators" ) ); 135 | 136 | if ( fx_indicators ) 137 | indicators ( ); 138 | 139 | draw_local_info ( ); 140 | // custom_rain ( ); 141 | } 142 | -------------------------------------------------------------------------------- /lunar_csgo_recode/hack/modules/visuals/misc.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../game/interfaces.hh" 4 | #include "../../game/globals.hh" 5 | 6 | #include 7 | #include 8 | 9 | namespace hack::modules::visuals::misc { 10 | struct rain_particle_t { 11 | c_vector3 m_origin , m_velocity; 12 | }; 13 | 14 | inline std::vector rain_particles; 15 | 16 | void in_endscene ( ); 17 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/lunar_csgo_recode.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /lunar_csgo_recode/main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "hack/game/modules.hh" 6 | #include "hack/game/globals.hh" 7 | #include "hack/game/addresses.hh" 8 | #include "hack/game/interfaces.hh" 9 | #include "hack/game/netvars.hh" 10 | 11 | #include "hack/hooks/handler.hh" 12 | 13 | #include "hack/menu/framework.hh" 14 | 15 | void open_debug_console ( ) { 16 | #if defined(_DEBUG) || defined(LUNAR_DEV) 17 | AllocConsole ( ); 18 | 19 | freopen_s ( ( FILE ** ) stdin , STR ( "CONIN$" ) , STR ( "r" ) , stdin ); 20 | freopen_s ( ( FILE ** ) stdout , STR ( "CONOUT$" ) , STR ( "w" ) , stdout ); 21 | 22 | /* boss */ 23 | SetConsoleTitleA ( STR ( "[redacted cheatcodes]" ) ); 24 | #endif 25 | } 26 | 27 | void close_debug_console ( ) { 28 | #if defined(_DEBUG) || defined(LUNAR_DEV) 29 | fclose ( ( FILE * ) stdin ); 30 | fclose ( ( FILE * ) stdout ); 31 | 32 | HWND console_hwnd = GetConsoleWindow ( ); 33 | 34 | FreeConsole ( ); 35 | PostMessageW ( console_hwnd , WM_CLOSE , 0 , 0 ); 36 | #endif 37 | } 38 | 39 | int dll_setup ( HMODULE this_module ) { 40 | /* grab this module */ 41 | hack::game::globals::this_instance = this_module; 42 | 43 | /* don't do anything until game is fully loaded up */ 44 | while ( !GetModuleHandleA ( STR ( "serverbrowser.dll" ) ) ) 45 | std::this_thread::sleep_for ( std::chrono::seconds ( 1 ) ); 46 | 47 | /* open debug console */ 48 | open_debug_console ( ); 49 | 50 | #if defined(_DEBUG) || defined(LUNAR_DEV) 51 | std::cout << "[info] - cheatname - hello, swoopae!\n"; 52 | std::cout << "[info] - compile date: " << __DATE__ << ' ' << __TIME__ << '\n'; 53 | #endif 54 | /* init our stuff */ 55 | 56 | /* game modules */ 57 | if ( !hack::game::modules::grab_modules ( ) ) { 58 | #if defined(_DEBUG) || defined(LUNAR_DEV) 59 | std::cout << "[ERROR] - couldn't initialize game modules!\n"; 60 | #endif 61 | goto uninit; 62 | } 63 | 64 | /* addresses */ 65 | if ( !hack::game::addresses::grab_addresses ( ) ) { 66 | #if defined(_DEBUG) || defined(LUNAR_DEV) 67 | std::cout << "[ERROR] - couldn't initialize memory addresses!\n"; 68 | #endif 69 | goto uninit; 70 | } 71 | 72 | /* interfaces */ 73 | if ( !hack::game::interfaces::grab_interfaces ( ) ) { 74 | #if defined(_DEBUG) || defined(LUNAR_DEV) 75 | std::cout << "[ERROR] - couldn't initialize game interfaces!\n"; 76 | #endif 77 | goto uninit; 78 | } 79 | 80 | /* netvars */ 81 | if ( !hack::game::netvars::grab_netvars ( ) ) { 82 | #if defined(_DEBUG) || defined(LUNAR_DEV) 83 | std::cout << "[ERROR] - couldn't dump game netvars!\n"; 84 | #endif 85 | goto uninit; 86 | } 87 | 88 | /* menu */ 89 | hack::menu::impl::init ( ); 90 | 91 | /* hooks */ 92 | if ( !hack::hooks::enable_hooks ( ) ) { 93 | #if defined(_DEBUG) || defined(LUNAR_DEV) 94 | std::cout << "[ERROR] - couldn't create hooks!\n"; 95 | #endif 96 | goto uninit; 97 | } 98 | 99 | /* wait for uninit */ 100 | #if defined(_DEBUG) || defined(LUNAR_DEV) 101 | while ( !hack::menu::input::key_down ( VK_DELETE ) ) 102 | #else 103 | while ( !hack::game::globals::should_uninject ) 104 | #endif 105 | std::this_thread::sleep_for ( std::chrono::seconds ( 1 ) ); 106 | 107 | uninit: 108 | /* unhook */ 109 | hack::hooks::disable_hooks ( ); 110 | 111 | std::this_thread::sleep_for ( std::chrono::seconds ( 1 ) ); 112 | 113 | /* close debug console */ 114 | close_debug_console ( ); 115 | 116 | std::this_thread::sleep_for ( std::chrono::seconds ( 1 ) ); 117 | 118 | FreeLibraryAndExitThread ( hack::game::globals::this_instance , 0 ); 119 | 120 | /* return */ 121 | return 0; 122 | } 123 | 124 | int __stdcall DllMain ( HMODULE this_module , unsigned long reason_for_call , void * reserved ) { 125 | switch ( reason_for_call ) { 126 | case DLL_PROCESS_ATTACH: 127 | DisableThreadLibraryCalls ( this_module ); 128 | if ( auto handle = CreateThread ( nullptr , 0 , ( LPTHREAD_START_ROUTINE ) dll_setup , this_module , 0 , nullptr ) ) 129 | CloseHandle ( handle ); 130 | break; 131 | } 132 | 133 | return 1; 134 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/entity.cc: -------------------------------------------------------------------------------- 1 | #include "entity.hh" 2 | 3 | #include "../hack/game/modules.hh" 4 | 5 | bool sdk::c_entity::dormant ( ) { 6 | const static auto dormant_offset = *( std::uintptr_t * )( sig ( MODULE_CLIENT_PANORAMA , STR ( "83 79 ? FF 74 07 8A 81 ? ? ? ? C3 32 C0 C3 6A 00" ) ) + 8 ) + 8; 7 | return *reinterpret_cast< bool * >( std::uintptr_t ( this ) + dormant_offset ); 8 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/entity.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef LUNAR_ENTITY 4 | #define LUNAR_ENTITY 5 | 6 | #include "../sdk/math/matrix3x4.hh" 7 | 8 | #include "../hack/game/netvars.hh" 9 | 10 | /* don't worry about me :) */ 11 | using csgo_handle = unsigned long; 12 | 13 | /* HUGE NOTE: next time i write a hack i should use the netvar names as the function names as well as use the original class/interface names and stop being a retard ~swoopae */ 14 | namespace sdk { 15 | class c_collision { 16 | public: 17 | /* netvars */ 18 | netvar_fn ( c_vector3 , mins , "DT_CollisionProperty->m_vecMins" ); 19 | netvar_fn ( c_vector3 , maxs , "DT_CollisionProperty->m_vecMaxs" ); 20 | netvar_fn ( char , solid_type , "DT_CollisionProperty->m_nSolidType" ); 21 | netvar_fn ( unsigned short , solid_flags , "DT_CollisionProperty->m_usSolidFlags" ); 22 | }; 23 | 24 | /* custom entity class */ 25 | class c_entity { 26 | public: 27 | /* offsets */ 28 | offset ( std::uint32_t , index , 0x64 ); 29 | offset ( std::int32_t , take_damage , 0x280 ); 30 | 31 | /* offsets to pointers */ 32 | poffset ( void * , renderable , 0x4 ); 33 | poffset ( void * , networkable , 0x8 ); 34 | poffset ( void * , unknown , 0xC ); 35 | 36 | /* netvars */ 37 | netvar_fn ( c_vector3 , origin , "DT_BaseEntity->m_vecOrigin" ); 38 | netvar_fn ( std::int32_t , team , "DT_BaseEntity->m_iTeamNum" ); 39 | netvar_fn ( float , simulation_time , "DT_BaseEntity->m_flSimulationTime" ); 40 | netvar_fn ( c_collision , collision , "DT_BaseEntity->m_Collision" ); 41 | 42 | /* values offset'd from netvars */ 43 | netvar_offset ( float , old_simulation_time , "DT_BaseEntity->m_flSimulationTime" , 0x4 ); 44 | netvar_offset ( c_matrix3x4 , coordonate_frame , "DT_BaseEntity->m_CollisionGroup" , -48 ); 45 | 46 | /* vfuncs and others */ 47 | bool dormant ( ); 48 | 49 | sdk::valve::client_class_t * client_class ( ) { 50 | return shared::memory::v_func< sdk::valve::client_class_t * ( __thiscall * )( void * ) > ( this , 2 )( this ); 51 | } 52 | 53 | c_vector3 & absolute_origin ( ) { 54 | return shared::memory::v_func< c_vector3 & ( __thiscall * )( void * ) > ( this , 10 )( this ); 55 | } 56 | 57 | c_vector3 & render_origin ( ) { 58 | return shared::memory::v_func< c_vector3 & ( __thiscall * )( void * ) > ( this->renderable ( ) , 1 )( this->renderable ( ) ); 59 | } 60 | 61 | void on_pre_data_change ( int update_type ) { 62 | shared::memory::v_func< void ( __thiscall * )( void * , int ) > ( this->networkable ( ) , 4 )( this->networkable ( ) , update_type ); 63 | } 64 | 65 | void on_post_data_change ( int update_type ) { 66 | shared::memory::v_func< void ( __thiscall * )( void * , int ) > ( this->networkable ( ) , 5 )( this->networkable ( ) , update_type ); 67 | } 68 | 69 | void pre_data_update ( int update_type ) { 70 | shared::memory::v_func< void ( __thiscall * )( void * , int ) > ( this->networkable ( ) , 6 )( this->networkable ( ) , update_type ); 71 | } 72 | 73 | void post_data_update ( int update_type ) { 74 | shared::memory::v_func< void ( __thiscall * )( void * , int ) > ( this->networkable ( ) , 7 )( this->networkable ( ) , update_type ); 75 | } 76 | 77 | /* int __thiscall sub_10199650(char *this) { return (int)(this + 800); } */ 78 | csgo_handle handle ( ) { 79 | return shared::memory::v_func< csgo_handle ( __thiscall * )( void * ) > ( this , 3 )( this ); 80 | } 81 | 82 | c_vector3 & absolute_angles ( ) { 83 | return shared::memory::v_func< c_vector3 & ( __thiscall * )( void * ) > ( this , 11 )( this ); 84 | } 85 | }; 86 | 87 | /* rain */ 88 | enum e_precipitation_types : int { 89 | precipitation_type_rain = 0 , 90 | precipitation_type_snow , 91 | precipitation_type_ash , 92 | precipitation_type_snowfall , 93 | precipitation_type_particlerain , 94 | precipitation_type_particleash , 95 | precipitation_type_particlerainstorm , 96 | precipitation_type_particlesnow , 97 | num_precipitation_types 98 | }; 99 | 100 | class c_precipitation_entity : public c_entity { 101 | public: 102 | /* netvars */ 103 | netvar_fn ( e_precipitation_types , precipitation_type , "DT_Precipitation->m_nPrecipType" ); 104 | 105 | netvar_offset ( void * , material_handle , "DT_Precipitation->m_nPrecipType" , -36 ); 106 | }; 107 | } 108 | 109 | #endif /* LUNAR_ENTITY */ -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/math/mathutils.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "matrix3x4.hh" 4 | 5 | #define pi 3.141593f 6 | #define rad_pi 57.295779513082f; 7 | 8 | #define rad2deg(x) ((float)(x) * (float)(180.f / pi)) 9 | #define deg2rad(x) ((float)(x) * (float)(pi / 180.f)) 10 | 11 | #define time_to_ticks(time) ( int ) ( 0.5f + time / hack::game::interfaces::global_vars->m_ipt ) 12 | #define ticks_to_time(ticks) hack::game::interfaces::global_vars->m_ipt * ( float ) ( ticks ) 13 | 14 | namespace sdk::math { 15 | __forceinline static void angle_vectors ( const c_vector3 & angles , c_vector3 & forward , c_vector3 * right = nullptr , c_vector3 * up = nullptr ) { 16 | const auto sp = sin ( deg2rad ( angles.x ) ) , cp = cos ( deg2rad ( angles.x ) ) , 17 | sy = sin ( deg2rad ( angles.y ) ) , cy = cos ( deg2rad ( angles.y ) ) , 18 | sr = sin ( deg2rad ( angles.z ) ) , cr = cos ( deg2rad ( angles.z ) ); 19 | 20 | forward.x = cp * cy; 21 | forward.y = cp * sy; 22 | forward.z = -sp; 23 | 24 | if ( right ) { 25 | right->x = -1 * sr * sp * cy + -1 * cr * -sy; 26 | right->y = -1 * sr * sp * sy + -1 * cr * cy; 27 | right->z = -1 * sr * cp; 28 | } 29 | 30 | if ( up ) { 31 | up->x = cr * sp * cy + -sr * -sy; 32 | up->y = cr * sp * sy + -sr * cy; 33 | up->z = cr * cp; 34 | } 35 | } 36 | 37 | __forceinline static void vector_angles ( const c_vector3 & fwd , c_vector3 & up , c_vector3 & out ) { 38 | c_vector3 left = up.cross_product ( fwd ); 39 | left.normalize_place ( ); 40 | 41 | auto lgth = fwd.length_2d ( ); 42 | 43 | if ( lgth > 0.001f ) { 44 | out.x = atan2f ( -fwd.z , lgth ) * 180 / math_pi; 45 | out.y = atan2f ( fwd.y , fwd.x ) * 180 / math_pi; 46 | 47 | float upZ = ( left.y * fwd.x ) - ( left.x * fwd.y ); 48 | out.z = atan2f ( left.z , upZ ) * 180 / math_pi; 49 | } else { 50 | out.x = atan2f ( -fwd.z , lgth ) * 180 / math_pi; 51 | out.y = atan2f ( -left.x , left.y ) * 180 / math_pi; 52 | out.z = 0; 53 | } 54 | } 55 | 56 | __forceinline static void vector_angles ( const c_vector3 & in , c_vector3 & out ) { 57 | if ( in.z == 0.f && in.x == 0.f ) { 58 | out.y = 0.f; 59 | 60 | if ( in.z > 0.f ) 61 | out.x = 90.f; 62 | else 63 | out.x = 270.f; 64 | } else { 65 | out.x = rad2deg ( atan2f ( -in.z , in.length_2d ( ) ) ); 66 | out.y = rad2deg ( atan2f ( in.y , in.x ) ); 67 | 68 | if ( out.x < 0.0f ) 69 | out.x += 360.0f; 70 | 71 | if ( out.y < 0.0f ) 72 | out.y += 360.0f; 73 | } 74 | 75 | out.x -= floorf ( out.x / 360.0f + 0.5f ) * 360.0f; 76 | out.y -= floorf ( out.y / 360.0f + 0.5f ) * 360.0f; 77 | 78 | if ( out.x > 89.0f ) 79 | out.x = 89.0f; 80 | else if ( out.x < -89.0f ) 81 | out.x = -89.0f; 82 | } 83 | 84 | __forceinline static void transform_vector ( const c_vector3 & a , const c_matrix3x4 & b , c_vector3 & out ) { 85 | out.x = a.dot_product ( b.m_values [ 0 ] ) + b.m_values [ 0 ][ 3 ]; 86 | out.y = a.dot_product ( b.m_values [ 1 ] ) + b.m_values [ 1 ][ 3 ]; 87 | out.z = a.dot_product ( b.m_values [ 2 ] ) + b.m_values [ 2 ][ 3 ]; 88 | } 89 | 90 | __forceinline static c_vector3 calc_angle ( const c_vector3 & from , const c_vector3 & to ) { 91 | static const auto ang_zero = c_vector3 ( 0.0f , 0.0f , 0.0f ); 92 | 93 | const auto delta = from - to; 94 | if ( delta.length ( ) <= 0.0f ) 95 | return ang_zero; 96 | 97 | if ( delta.z == 0.0f && delta.length ( ) == 0.0f ) 98 | return ang_zero; 99 | 100 | if ( delta.y == 0.0f && delta.x == 0.0f ) 101 | return ang_zero; 102 | 103 | c_vector3 angles; 104 | angles.x = asinf ( delta.z / delta.length ( ) ) * rad_pi; 105 | angles.y = atanf ( delta.y / delta.x ) * rad_pi; 106 | angles.z = 0.0f; 107 | 108 | if ( delta.x >= 0.0f ) 109 | angles.y += 180.0f; 110 | 111 | return angles; 112 | } 113 | 114 | __forceinline static float get_fov ( const c_vector3 & from , const c_vector3 & to , const c_vector3 & angs ) { 115 | c_vector3 dir , fw; 116 | dir = ( to - from ).normalized ( ); 117 | angle_vectors ( angs , fw ); 118 | return std::max ( rad2deg ( std::acos ( fw.dot_product ( dir ) ) ) , 0.f ); 119 | } 120 | 121 | __forceinline static c_vector3 interpolate ( const c_vector3 & from , const c_vector3 & to , const float percent ) { 122 | return to * percent + from * ( 1.f - percent ); 123 | } 124 | 125 | __forceinline static float interpolate ( const float from , const float to , const float percent ) { 126 | return to * percent + from * ( 1.f - percent ); 127 | } 128 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/math/matrix3x4.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "vector.hh" 4 | 5 | class c_matrix3x4 { 6 | public: 7 | float m_values [ 3 ][ 4 ]; 8 | 9 | c_matrix3x4 ( void ) { 10 | m_values [ 0 ][ 0 ] = 0.0f; m_values [ 0 ][ 1 ] = 0.0f; m_values [ 0 ][ 2 ] = 0.0f; m_values [ 0 ][ 3 ] = 0.0f; 11 | m_values [ 1 ][ 0 ] = 0.0f; m_values [ 1 ][ 1 ] = 0.0f; m_values [ 1 ][ 2 ] = 0.0f; m_values [ 1 ][ 3 ] = 0.0f; 12 | m_values [ 2 ][ 0 ] = 0.0f; m_values [ 2 ][ 1 ] = 0.0f; m_values [ 2 ][ 2 ] = 0.0f; m_values [ 2 ][ 3 ] = 0.0f; 13 | } 14 | 15 | c_matrix3x4 ( 16 | float m00 , float m01 , float m02 , float m03 , 17 | float m10 , float m11 , float m12 , float m13 , 18 | float m20 , float m21 , float m22 , float m23 ) { 19 | m_values [ 0 ][ 0 ] = m00; m_values [ 0 ][ 1 ] = m01; m_values [ 0 ][ 2 ] = m02; m_values [ 0 ][ 3 ] = m03; 20 | m_values [ 1 ][ 0 ] = m10; m_values [ 1 ][ 1 ] = m11; m_values [ 1 ][ 2 ] = m12; m_values [ 1 ][ 3 ] = m13; 21 | m_values [ 2 ][ 0 ] = m20; m_values [ 2 ][ 1 ] = m21; m_values [ 2 ][ 2 ] = m22; m_values [ 2 ][ 3 ] = m23; 22 | } 23 | 24 | void init ( const c_vector3 & x , const c_vector3 & y , const c_vector3 & z , const c_vector3 & origin ) { 25 | m_values [ 0 ][ 0 ] = x.x; m_values [ 0 ][ 1 ] = y.x; m_values [ 0 ][ 2 ] = z.x; m_values [ 0 ][ 3 ] = origin.x; 26 | m_values [ 1 ][ 0 ] = x.y; m_values [ 1 ][ 1 ] = y.y; m_values [ 1 ][ 2 ] = z.y; m_values [ 1 ][ 3 ] = origin.y; 27 | m_values [ 2 ][ 0 ] = x.z; m_values [ 2 ][ 1 ] = y.z; m_values [ 2 ][ 2 ] = z.z; m_values [ 2 ][ 3 ] = origin.z; 28 | } 29 | 30 | c_matrix3x4 ( const c_vector3 & x , const c_vector3 & y , const c_vector3 & z , const c_vector3 & origin ) { 31 | init ( x , y , z , origin ); 32 | } 33 | 34 | inline void set_origin ( c_vector3 const & p ) { 35 | m_values [ 0 ][ 3 ] = p.x; 36 | m_values [ 1 ][ 3 ] = p.y; 37 | m_values [ 2 ][ 3 ] = p.z; 38 | } 39 | 40 | inline void invalidate ( void ) { 41 | for ( int i = 0; i < 3; i++ ) { 42 | for ( int j = 0; j < 4; j++ ) { 43 | m_values [ i ][ j ] = std::numeric_limits::infinity ( ); 44 | } 45 | } 46 | } 47 | 48 | c_vector3 get_x_axis ( void ) const { 49 | return at ( 0 ); 50 | } 51 | 52 | c_vector3 get_y_axis ( void ) const { 53 | return at ( 1 ); 54 | } 55 | 56 | c_vector3 get_z_axis ( void ) const { 57 | return at ( 2 ); 58 | } 59 | 60 | c_vector3 origin ( void ) const { 61 | return at ( 3 ); 62 | } 63 | 64 | c_vector3 at ( int i ) const { 65 | return c_vector3 { m_values [ 0 ][ i ], m_values [ 1 ][ i ], m_values [ 2 ][ i ] }; 66 | } 67 | 68 | float * operator[]( int i ) { 69 | return m_values [ i ]; 70 | } 71 | 72 | const float * operator[]( int i ) const { 73 | return m_values [ i ]; 74 | } 75 | 76 | float * base ( ) { 77 | return &m_values [ 0 ][ 0 ]; 78 | } 79 | 80 | const float * base ( ) const { 81 | return &m_values [ 0 ][ 0 ]; 82 | } 83 | 84 | const bool operator==( c_matrix3x4 matrix ) const { 85 | return 86 | m_values [ 0 ][ 0 ] == matrix [ 0 ][ 0 ] && m_values [ 0 ][ 1 ] == matrix [ 0 ][ 1 ] && m_values [ 0 ][ 2 ] == matrix [ 0 ][ 2 ] && m_values [ 0 ][ 3 ] == matrix [ 0 ][ 3 ] && 87 | m_values [ 1 ][ 0 ] == matrix [ 1 ][ 0 ] && m_values [ 1 ][ 1 ] == matrix [ 1 ][ 1 ] && m_values [ 1 ][ 2 ] == matrix [ 1 ][ 2 ] && m_values [ 1 ][ 3 ] == matrix [ 1 ][ 3 ] && 88 | m_values [ 2 ][ 0 ] == matrix [ 2 ][ 0 ] && m_values [ 2 ][ 1 ] == matrix [ 2 ][ 1 ] && m_values [ 2 ][ 2 ] == matrix [ 2 ][ 2 ] && m_values [ 2 ][ 3 ] == matrix [ 2 ][ 3 ]; 89 | } 90 | }; 91 | 92 | class v_matrix { 93 | public: 94 | v_matrix ( ); 95 | v_matrix ( 96 | float m00 , float m01 , float m02 , float m03 , 97 | float m10 , float m11 , float m12 , float m13 , 98 | float m20 , float m21 , float m22 , float m23 , 99 | float m30 , float m31 , float m32 , float m33 100 | ); 101 | 102 | void init ( 103 | float m00 , float m01 , float m02 , float m03 , 104 | float m10 , float m11 , float m12 , float m13 , 105 | float m20 , float m21 , float m22 , float m23 , 106 | float m30 , float m31 , float m32 , float m33 107 | ); 108 | 109 | // array access 110 | inline float * operator[]( int i ) { 111 | return m [ i ]; 112 | } 113 | 114 | inline const float * operator[]( int i ) const { 115 | return m [ i ]; 116 | } 117 | 118 | // pointer to m[0][0] 119 | inline float * base ( ) { 120 | return &m [ 0 ][ 0 ]; 121 | } 122 | 123 | inline const float * base ( ) const { 124 | return &m [ 0 ][ 0 ]; 125 | } 126 | 127 | public: 128 | float m [ 4 ][ 4 ]; 129 | }; -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/sdk.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef LUNAR_CSSDK 4 | #define LUNAR_CSSDK 5 | 6 | #include "valve/valve_vector.hh" 7 | 8 | #include "player.hh" 9 | 10 | #include "valve/global_vars.hh" 11 | #include "valve/event_listener.hh" 12 | #include "valve/view_render_beams.hh" 13 | #include "valve/app_system.hh" 14 | #include "valve/base_client.hh" 15 | #include "valve/debug_overlay.hh" 16 | #include "valve/surface_props.hh" 17 | #include "valve/user_cmd.hh" 18 | #include "valve/engine.hh" 19 | #include "valve/entity_list.hh" 20 | #include "valve/cvar.hh" 21 | #include "valve/input.hh" 22 | #include "valve/input_system.hh" 23 | #include "valve/model_info.hh" 24 | #include "valve/panel.hh" 25 | #include "valve/prediction.hh" 26 | #include "valve/render_view.hh" 27 | #include "valve/surface.hh" 28 | #include "valve/engine_trace.hh" 29 | #include "valve/clientstate.hh" 30 | #include "valve/class_map.hh" 31 | #include "valve/client_precipitation.hh" 32 | #include "valve/material.hh" 33 | 34 | #endif /* LUNAR_CSSDK */ -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/app_system.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace sdk::valve { 4 | typedef void * ( *make_interface_fn )( const char * name , int * return_code ); 5 | 6 | class c_app_system { 7 | public: 8 | virtual bool connect ( make_interface_fn factory ) = 0; 9 | virtual void disconnect ( ) = 0; 10 | virtual void * query_interface ( const char * p_interface_name ) = 0; 11 | virtual int init ( ) = 0; 12 | virtual void shutdown ( ) = 0; 13 | virtual const void * get_dependencies ( ) = 0; 14 | virtual int get_tier ( ) = 0; 15 | virtual void reconnect ( make_interface_fn factory , const char * p_interface_name ) = 0; 16 | virtual void unk_func ( ) = 0; 17 | }; 18 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/class_map.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace sdk::valve { 4 | class c_classmap { 5 | public: 6 | virtual void add ( const char * mapname , const char * classname , int size , void* factory = 0 ) = 0; 7 | virtual char const * lookup ( const char * classname ) = 0; 8 | virtual void * create_entity_by_name ( const char * mapname ) = 0; 9 | virtual int get_class_entity ( const char * classname ) = 0; 10 | }; 11 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/client_precipitation.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace sdk::valve { 4 | /* obsoleted */ 5 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/clientstate.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../shared/memory/memory.hh" 4 | 5 | #include "../math/vector.hh" 6 | 7 | namespace sdk::valve { 8 | class c_clientstate { 9 | public: 10 | void force_fullupdate ( ) { 11 | delta_tick = -1; 12 | } 13 | 14 | pad ( 156 ); 15 | void * net_channel; 16 | std::uint32_t challenge_nr; 17 | pad ( 100 ); 18 | std::uint32_t sign_on_state; 19 | pad ( 8 ); 20 | float next_cmd_time; 21 | std::uint32_t server_count; 22 | std::uint32_t curr_sequence; 23 | pad ( 84 ); 24 | std::uint32_t delta_tick; 25 | bool paused; 26 | pad ( 3 ); 27 | std::uint32_t view_ent; 28 | std::uint32_t player_slot; 29 | char level_name [ 260 ]; 30 | char short_level_name [ 80 ]; 31 | char group_name [ 80 ]; 32 | pad ( 92 ); 33 | std::uint32_t max_clients; 34 | pad ( 18828 ); 35 | float last_server_tick_time; 36 | bool in_simulation; 37 | pad ( 3 ); 38 | std::uint32_t oldtickcount; 39 | float tick_emainder; 40 | float frame_time; 41 | int last_outgoing_command; 42 | int choked_commands; 43 | int last_command_ack; 44 | int command_ack; 45 | int sound_sequence; 46 | pad ( 80 ); 47 | c_vector3 viewangles; 48 | pad ( 208 ); 49 | void * events; 50 | }; 51 | 52 | class c_viewsetup { 53 | public: 54 | pad ( 176 ); 55 | float m_fov; 56 | float m_viewmodel_fov; 57 | c_vector3 m_origin; 58 | c_vector3 m_angles; 59 | pad ( 124 ); 60 | }; 61 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/cvar.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "app_system.hh" 4 | 5 | #include "../math/matrix3x4.hh" 6 | 7 | #include "../../shared/memory/memory.hh" 8 | #include "../../shared/color/color.hh" 9 | 10 | namespace sdk::valve { 11 | enum cvar_flags { 12 | fcvar_none = 0 , 13 | fcvar_unregistered = ( 1 << 0 ) , 14 | fcvar_developmentonly = ( 1 << 1 ) , 15 | fcvar_gamedll = ( 1 << 2 ) , 16 | fcvar_clientdll = ( 1 << 3 ) , 17 | fcvar_hidden = ( 1 << 4 ) , 18 | fcvar_protected = ( 1 << 5 ) , 19 | fcvar_sponly = ( 1 << 6 ) , 20 | fcvar_archive = ( 1 << 7 ) , 21 | fcvar_notify = ( 1 << 8 ) , 22 | fcvar_userinfo = ( 1 << 9 ) , 23 | fcvar_printableonly = ( 1 << 10 ) , 24 | fcvar_unlogged = ( 1 << 11 ) , 25 | fcvar_never_as_string = ( 1 << 12 ) , 26 | fcvar_replicated = ( 1 << 13 ) , 27 | fcvar_cheat = ( 1 << 14 ) , 28 | fcvar_ss = ( 1 << 15 ) , 29 | fcvar_demo = ( 1 << 16 ) , 30 | fcvar_dontrecord = ( 1 << 17 ) , 31 | fcvar_ss_added = ( 1 << 18 ) , 32 | fcvar_release = ( 1 << 19 ) , 33 | fcvar_reload_materials = ( 1 << 20 ) , 34 | fcvar_reload_textures = ( 1 << 21 ) , 35 | fcvar_not_connected = ( 1 << 22 ) , 36 | fcvar_material_system_thread = ( 1 << 23 ) , 37 | fcvar_archive_xbox = ( 1 << 24 ) , 38 | fcvar_accessible_from_threads = ( 1 << 25 ) , 39 | fcvar_server_can_execute = ( 1 << 28 ) , 40 | fcvar_server_cannot_query = ( 1 << 29 ) , 41 | fcvar_clientcmd_can_execute = ( 1 << 30 ) , 42 | fcvar_meme_dll = ( 1 << 31 ) , 43 | fcvar_material_thread_mask = ( fcvar_reload_materials | fcvar_reload_textures | fcvar_material_system_thread ) 44 | }; 45 | 46 | class c_convar { 47 | public: 48 | void set_value ( const char * value ) { 49 | using original_fn = void ( __thiscall * )( c_convar * , const char * ); 50 | return ( *( original_fn ** ) this ) [ 14 ] ( this , value ); 51 | } 52 | void set_value ( float value ) { 53 | using original_fn = void ( __thiscall * )( c_convar * , float ); 54 | return ( *( original_fn ** ) this ) [ 15 ] ( this , value ); 55 | } 56 | void set_value ( int value ) { 57 | using original_fn = void ( __thiscall * )( c_convar * , int ); 58 | return ( *( original_fn ** ) this ) [ 16 ] ( this , value ); 59 | } 60 | void set_value ( bool value ) { 61 | using original_fn = void ( __thiscall * )( c_convar * , int ); 62 | return ( *( original_fn ** ) this ) [ 16 ] ( this , static_cast< int >( value ) ); 63 | } 64 | 65 | float get_float ( ) { 66 | const auto val = *reinterpret_cast< std::uint32_t * >( &float_value ); 67 | auto xored = static_cast< std::uint32_t >( val ^ reinterpret_cast< std::uint32_t >( this ) ); 68 | return *reinterpret_cast< float * >( &xored ); 69 | } 70 | 71 | std::int32_t get_int ( ) { 72 | const auto val = *reinterpret_cast< std::uint32_t * >( &numerical_value ); 73 | auto xored = static_cast< std::uint32_t >( val ^ reinterpret_cast< std::uint32_t >( this ) ); 74 | return *reinterpret_cast< std::int32_t * >( &xored ); 75 | } 76 | 77 | public: 78 | pad ( 4 ); 79 | c_convar * next; 80 | std::int32_t is_registered; 81 | char * name; 82 | char * help_string; 83 | std::int32_t flags; 84 | pad ( 4 ); 85 | c_convar * parent; 86 | char * default_value; 87 | char * string; 88 | std::int32_t string_length; 89 | float float_value; 90 | std::int32_t numerical_value; 91 | std::int32_t has_min; 92 | float min; 93 | std::int32_t has_max; 94 | float max; 95 | void * change_callbacks; 96 | }; 97 | 98 | class c_console_display_func { 99 | public: 100 | virtual void color_print ( const std::uint8_t * clr , const char * pMessage ) = 0; 101 | virtual void print ( const char * pMessage ) = 0; 102 | virtual void d_print ( const char * pMessage ) = 0; 103 | }; 104 | 105 | class c_convar_system : public c_app_system { 106 | public: 107 | virtual int allocate_dll_indentifier ( ) = 0; 108 | virtual void register_con_command ( void * pCommandBase ) = 0; 109 | virtual void unregister_con_command ( void * pCommandBase ) = 0; 110 | virtual void unregister_con_commands ( int id ) = 0; 111 | virtual const char * get_command_line_value ( const char * pVariableName ) = 0; 112 | virtual void * find_command_base ( const char * name ) = 0; 113 | virtual const void * find_command_base ( const char * name ) const = 0; 114 | virtual c_convar * get_convar ( const char * var_name ) = 0; 115 | virtual const c_convar * get_convar ( const char * var_name ) const = 0; 116 | virtual void * find_command ( const char * name ) = 0; 117 | virtual const void * find_command ( const char * name ) const = 0; 118 | virtual void install_global_change_callback ( void * callback ) = 0; 119 | virtual void remove_global_change_callback ( void * callback ) = 0; 120 | virtual void call_global_change_callbacks ( c_convar * var , const char * pOldString , float flOldValue ) = 0; 121 | virtual void install_console_display_func ( c_console_display_func * pDisplayFunc ) = 0; 122 | virtual void remove_console_display_func ( c_console_display_func * pDisplayFunc ) = 0; 123 | virtual void console_color_printf ( const c_color & clr , const char * pFormat , ... ) const = 0; 124 | virtual void console_printf ( const char * pFormat , ... ) const = 0; 125 | virtual void donsole_dprintf ( const char * pFormat , ... ) const = 0; 126 | virtual void rever_flagged_convars ( int nFlag ) = 0; 127 | }; 128 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/debug_overlay.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/vector.hh" 4 | 5 | #include "../../shared/memory/memory.hh" 6 | #include "../../shared/color/color.hh" 7 | 8 | namespace sdk::valve { 9 | class c_debug_overlay { 10 | public: 11 | void add_line_overlay ( c_vector3 & origin , c_vector3 & dest , c_color colour , float duration ) { 12 | using fn = void ( __thiscall * )( void * , c_vector3 & , c_vector3 & , int , int , int , bool , float ); 13 | shared::memory::v_func< fn > ( this , 5 )( this , origin , dest , colour.r , colour.g , colour.b , false , duration ); 14 | } 15 | 16 | int screen_position ( const c_vector3 & point , c_vector3 & screen ) { 17 | using fn = int ( __thiscall * )( void * , const c_vector3 & , c_vector3 & ); 18 | return shared::memory::v_func< fn > ( this , 13 )( this , point , screen ); 19 | } 20 | }; 21 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/entity_list.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../shared/memory/memory.hh" 4 | 5 | namespace sdk::valve { 6 | class c_entity_list { 7 | public: 8 | template < typename t > 9 | t get ( int index ) { 10 | using fn = t ( __thiscall * )( void * , int ); 11 | return shared::memory::v_func< fn > ( this , 3 )( this , index ); 12 | } 13 | 14 | template < typename t > 15 | t get_by_handle ( csgo_handle handle ) { 16 | using fn = t ( __thiscall * )( void * , csgo_handle ); 17 | return shared::memory::v_func< fn > ( this , 4 )( this , handle ); 18 | } 19 | 20 | int entity_num ( bool include_non_networkable = false ) { 21 | using fn = int ( __thiscall * )( void * , bool ); 22 | return shared::memory::v_func< fn > ( this , 5 )( this , include_non_networkable ); 23 | } 24 | 25 | int highest_entity_index ( ) { 26 | using fn = int ( __thiscall * )( void * ); 27 | return shared::memory::v_func< fn > ( this , 6 )( this ); 28 | } 29 | 30 | int max_entities ( ) { 31 | using fn = int ( __thiscall * )( void * ); 32 | return shared::memory::v_func< fn > ( this , 8 )( this ); 33 | } 34 | }; 35 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/event_listener.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace sdk::valve { 4 | class event_t { 5 | public: 6 | virtual ~event_t ( ) = 0; 7 | virtual const char * get_name ( ) const = 0; 8 | 9 | virtual bool is_reliable ( ) const = 0; 10 | virtual bool is_local ( ) const = 0; 11 | virtual bool is_empty ( const char * key = nullptr ) = 0; 12 | 13 | virtual bool get_bool ( const char * key = nullptr , bool v = false ) = 0; 14 | virtual int get_int ( const char * key = nullptr , int v = 0 ) = 0; 15 | virtual unsigned long long get_uint64 ( const char * key = nullptr , unsigned long v = 0 ) = 0; 16 | virtual float get_float ( const char * key = nullptr , float v = 0.0f ) = 0; 17 | virtual const char * get_string ( const char * key = nullptr , const char * v = "" ) = 0; 18 | virtual const wchar_t * get_w_string ( const char * key , const wchar_t * v = L"" ) = 0; 19 | 20 | virtual void set_bool ( const char * key , bool value ) = 0; 21 | virtual void set_int ( const char * key , int value ) = 0; 22 | virtual void set_uint_64 ( const char * key , unsigned long value ) = 0; 23 | virtual void set_float ( const char * key , float value ) = 0; 24 | virtual void set_string ( const char * key , const char * value ) = 0; 25 | virtual void set_w_string ( const char * key , const wchar_t * value ) = 0; 26 | }; 27 | 28 | class event_listener { 29 | public: 30 | virtual ~event_listener ( void ) { }; 31 | 32 | virtual void fire_game_event ( event_t * event ) = 0; 33 | virtual int get_event_debug_id ( void ) = 0; 34 | }; 35 | 36 | class c_event_manager { 37 | public: 38 | virtual ~c_event_manager ( ) = 0; 39 | virtual int load_events_from_file ( const char * filename ) = 0; 40 | virtual void reset ( ) = 0; 41 | virtual bool add_listener ( event_listener * listener , const char * name , bool server_side ) = 0; 42 | virtual bool find_listener ( event_listener * listener , const char * name ) = 0; 43 | virtual int remove_listener ( event_listener * listener ) = 0; 44 | }; 45 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/global_vars.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace sdk::valve { 4 | class c_global_vars { 5 | public: 6 | float m_realtime; 7 | int m_framecount; 8 | float m_abs_frametime; 9 | float m_abs_framestarttimestddev; 10 | float m_curtime; 11 | float m_frametime; 12 | int m_max_clients; 13 | int m_tickcount; 14 | float m_ipt; 15 | float m_interp; 16 | }; 17 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/input.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "user_cmd.hh" 4 | 5 | namespace sdk::valve { 6 | class c_input { 7 | public: 8 | void * m_ptable; 9 | pad ( 8 ); 10 | bool m_track_ir_available; 11 | bool m_mouse_initialized; 12 | bool m_mouse_active; 13 | bool m_joystick_advanced_init; 14 | pad ( 44 ); 15 | void * m_keys; 16 | pad ( 108 ); 17 | bool m_camera_intercepting_mouse; 18 | bool m_camera_in_thirdperson; 19 | bool m_camera_moving_with_mouse; 20 | c_vector3 m_camera_offset; 21 | bool m_camera_distance_move; 22 | int m_camera_old_x; 23 | int m_camera_old_y; 24 | int m_camera_x; 25 | int m_camera_y; 26 | bool m_camera_is_orthographic; 27 | c_vector3 m_prev_viewangles; 28 | c_vector3 m_prev_viewangles_tilt; 29 | float m_last_forward_move; 30 | int m_clear_input_state; 31 | 32 | ucmd_t * get_usercmd ( int slot , int sequence_number ) { 33 | c_input * unk = this; 34 | 35 | if ( slot != -1 ) 36 | unk = &this [ 0xDC * slot ]; 37 | 38 | auto ret = ( ucmd_t * ) ( *( ( std::uintptr_t * ) unk + 0x3D ) + sizeof ( ucmd_t ) * ( sequence_number % 150 ) ); 39 | 40 | if ( ret->m_cmdnum != sequence_number ) 41 | ret = nullptr; 42 | 43 | return ret; 44 | } 45 | 46 | ucmd_t * get_usercmds ( int sequence_number ) { 47 | return ( ucmd_t * ) ( *( ( std::uintptr_t * ) this + 0x3D ) + sizeof ( ucmd_t ) * ( sequence_number % 150 ) ); 48 | } 49 | }; 50 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/input_system.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../shared/memory/memory.hh" 4 | 5 | namespace sdk::valve { 6 | class c_input_system { 7 | public: 8 | void * enable_input ( bool enable ) { 9 | return shared::memory::v_func< void * ( __thiscall * )( void * , bool ) > ( this , 11 )( this , enable ); 10 | } 11 | }; 12 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/material.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/matrix3x4.hh" 4 | #include "../math/vector.hh" 5 | 6 | #include "../../shared/color/color.hh" 7 | #include "../../shared/memory/memory.hh" 8 | 9 | #define material_var_debug ( 1 << 0 ) 10 | #define material_var_no_debug_override ( 1 << 1 ) 11 | #define material_var_no_draw ( 1 << 2 ) 12 | #define material_var_use_in_fillrate_mode ( 1 << 3 ) 13 | #define material_var_vertexcolor ( 1 << 4 ) 14 | #define material_var_vertexalpha ( 1 << 5 ) 15 | #define material_var_selfillum ( 1 << 6 ) 16 | #define material_var_additive ( 1 << 7 ) 17 | #define material_var_alphatest ( 1 << 8 ) 18 | #define material_var_znearer ( 1 << 10 ) 19 | #define material_var_model ( 1 << 11 ) 20 | #define material_var_flat ( 1 << 12 ) 21 | #define material_var_nocull ( 1 << 13 ) 22 | #define material_var_nofog ( 1 << 14 ) 23 | #define material_var_ignorez ( 1 << 15 ) 24 | #define material_var_decal ( 1 << 16 ) 25 | #define material_var_envmapsphere ( 1 << 17 ) 26 | #define material_var_envmapcameraspace ( 1 << 19 ) 27 | #define material_var_basealphaenvmapmask ( 1 << 20 ) 28 | #define material_var_translucent ( 1 << 21 ) 29 | #define material_var_normalmapalphaenvmapmask ( 1 << 22 ) 30 | #define material_var_opaquetexture ( 1 << 24 ) 31 | #define material_var_suppress_decals ( 1 << 26 ) 32 | #define material_var_halflambert ( 1 << 27 ) 33 | #define material_var_wireframe ( 1 << 28 ) 34 | #define material_var_allowalphatocoverage ( 1 << 29 ) 35 | #define material_var_alpha_modified_by_proxy ( 1 << 30 ) 36 | #define material_var_vertexfog ( 1 << 31 ) 37 | 38 | namespace sdk::valve { 39 | class material_t { 40 | public: 41 | const char * get_name ( void ) { 42 | using getname_fn = const char * ( __thiscall * )( void * ); 43 | return shared::memory::v_func< getname_fn > ( this , 0 )( this ); 44 | } 45 | 46 | const char * get_texture_group_name ( void ) { 47 | using gettexturegroupname_fn = const char * ( __thiscall * )( void * ); 48 | return shared::memory::v_func< gettexturegroupname_fn > ( this , 1 )( this ); 49 | } 50 | 51 | void increment_reference_count ( void ) { 52 | using increferencecount_fn = void ( __thiscall * )( void * ); 53 | shared::memory::v_func< increferencecount_fn > ( this , 12 )( this ); 54 | } 55 | 56 | void * find_var ( const char * var , bool * found , bool complain = true ) { 57 | using findvar_fn = void * ( __thiscall * )( void * , const char * , bool * , bool ); 58 | return shared::memory::v_func< findvar_fn > ( this , 11 )( this , var , found , complain ); 59 | } 60 | 61 | void color_modulate ( c_color clr ) { 62 | using colormodulate_fn = void ( __thiscall * )( void * , float , float , float ); 63 | shared::memory::v_func< colormodulate_fn > ( this , 28 )( this , ( float ) clr.r / 255.0f , ( float ) clr.g / 255.0f , ( float ) clr.b / 255.0f ); 64 | } 65 | 66 | void set_material_var_flag ( std::uint32_t flag , bool state ) { 67 | using setmaterialvarflag_fn = void ( __thiscall * )( void * , std::uint32_t , bool ); 68 | shared::memory::v_func< setmaterialvarflag_fn > ( this , 29 )( this , flag , state ); 69 | } 70 | }; 71 | 72 | class c_model_render { 73 | public: 74 | void force_mat_override ( material_t * mat ) { 75 | using original_fn = void ( __thiscall * )( c_model_render * , material_t * , int , int ); 76 | shared::memory::v_func< original_fn > ( this , 1 )( this , mat , 0 , 0 ); 77 | } 78 | }; 79 | 80 | class c_materialsystem { 81 | public: 82 | material_t * create_material ( const char * name , void * kv ) { 83 | using creatematerial_fn = material_t * ( __thiscall * )( void * , const char * , void * ); 84 | return shared::memory::v_func< creatematerial_fn > ( this , 83 )( this , name , kv ); 85 | } 86 | 87 | material_t * find_material ( char const * material_name , const char * group_name = nullptr , bool complain = true , const char * complain_prefix = 0 ) { 88 | using original_fn = material_t * ( __thiscall * )( c_materialsystem * , char const * , const char * , bool , const char * ); 89 | return shared::memory::v_func< original_fn > ( this , 84 )( this , material_name , group_name , complain , complain_prefix ); 90 | } 91 | int get_materials_count ( ) { 92 | using original_fn = int ( __thiscall * )( c_materialsystem * ); 93 | return shared::memory::v_func< original_fn > ( this , 90 )( this ); 94 | } 95 | }; 96 | 97 | struct model_render_info_t { 98 | c_vector3 origin; 99 | c_vector3 angles; 100 | pad ( 4 ); 101 | void * renderable; 102 | const void * model; 103 | const c_matrix3x4 * model_to_world; 104 | const c_matrix3x4 * lighting_offset; 105 | const c_vector3 * lighting_origin; 106 | int flags; 107 | int entity_index; 108 | int skin; 109 | int body; 110 | int hitboxset; 111 | unsigned short instance; 112 | 113 | model_render_info_t ( ) { 114 | model_to_world = 0; 115 | lighting_offset = 0; 116 | lighting_origin = 0; 117 | } 118 | }; 119 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/model_info.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/matrix3x4.hh" 4 | 5 | #include "../../shared/memory/memory.hh" 6 | 7 | namespace sdk::valve { 8 | struct model_t { 9 | char name [ 255 ]; 10 | }; 11 | 12 | struct studio_bone_t { 13 | int name_index; 14 | inline char * const name ( void ) const { 15 | return ( ( char * ) this ) + name_index; 16 | } 17 | int parent; 18 | int bone_controller [ 6 ]; 19 | 20 | c_vector3 pos; 21 | float quat [ 4 ]; 22 | float rotation [ 3 ]; 23 | 24 | c_vector3 pos_scale; 25 | c_vector3 rot_scale; 26 | 27 | c_matrix3x4 pose_to_bone; 28 | float quat_alignement [ 4 ]; 29 | int flags; 30 | int proc_type; 31 | int proc_index; 32 | mutable int physics_bone; 33 | 34 | inline void * procedure ( ) const { 35 | if ( proc_index == 0 ) return 0; 36 | else return( void * ) ( ( ( unsigned char * ) this ) + proc_index ); 37 | }; 38 | 39 | int surface_prop_idx; 40 | inline char * const surface_prop ( void ) const { 41 | return ( ( char * ) this ) + surface_prop_idx; 42 | } 43 | inline int get_surface_prop ( void ) const { 44 | return surf_prop_lookup; 45 | } 46 | 47 | int contents; 48 | int surf_prop_lookup; 49 | int unused [ 7 ]; 50 | }; 51 | 52 | struct studio_box_t { 53 | int bone; 54 | int group; 55 | c_vector3 mins; 56 | c_vector3 maxs; 57 | int name_index; 58 | int pad01 [ 3 ]; 59 | float radius; 60 | int pad02 [ 4 ]; 61 | }; 62 | 63 | struct studio_hitbox_set_t { 64 | int name_index; 65 | int hitbox_count; 66 | int hitbox_index; 67 | 68 | inline char * const name ( void ) const { 69 | return ( ( char * ) this ) + name_index; 70 | } 71 | inline studio_box_t * hitbox ( int i ) const { 72 | return ( studio_box_t * ) ( ( ( unsigned char * ) this ) + hitbox_index ) + i; 73 | } 74 | }; 75 | 76 | class c_studio_hdr { 77 | public: 78 | int id; 79 | int version; 80 | long checksum; 81 | char name_char_array [ 64 ]; 82 | int length; 83 | c_vector3 eye_pos; 84 | c_vector3 illium_pos; 85 | c_vector3 hull_mins; 86 | c_vector3 hull_maxs; 87 | c_vector3 mins; 88 | c_vector3 maxs; 89 | int flags; 90 | int bones_count; 91 | int bone_index; 92 | int bone_controllers_count; 93 | int bone_controller_index; 94 | int hitbox_sets_count; 95 | int hitbox_set_index; 96 | int local_anim_count; 97 | int local_anim_index; 98 | int local_seq_count; 99 | int local_seq_index; 100 | int activity_list_version; 101 | int events_indexed; 102 | int textures_count; 103 | int texture_index; 104 | 105 | studio_hitbox_set_t * hitbox_set ( int i ) { 106 | if ( i > hitbox_sets_count ) return nullptr; 107 | return ( studio_hitbox_set_t * ) ( ( uint8_t * ) this + hitbox_set_index ) + i; 108 | } 109 | studio_bone_t * bone ( int i ) { 110 | if ( i > bones_count ) return nullptr; 111 | return ( studio_bone_t * ) ( ( uint8_t * ) this + bone_index ) + i; 112 | } 113 | }; 114 | 115 | class c_model_info { 116 | public: 117 | model_t * get_model ( int index ) { 118 | using original_fn = model_t * ( __thiscall * )( c_model_info * , int ); 119 | return shared::memory::v_func ( this , 1 )( this , index ); 120 | } 121 | int get_model_index ( const char * filename ) { 122 | using original_fn = int ( __thiscall * )( c_model_info * , const char * ); 123 | return shared::memory::v_func ( this , 2 )( this , filename ); 124 | } 125 | const char * get_model_name ( const model_t * model ) { 126 | using original_fn = const char * ( __thiscall * )( c_model_info * , const model_t * ); 127 | return shared::memory::v_func ( this , 3 )( this , model ); 128 | } 129 | c_studio_hdr * get_studio_model ( const model_t * model ) { 130 | using original_fn = c_studio_hdr * ( __thiscall * )( c_model_info * , const model_t * ); 131 | return shared::memory::v_func ( this , 32 )( this , model ); 132 | } 133 | }; 134 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/panel.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../shared/memory/memory.hh" 4 | 5 | namespace sdk::valve { 6 | class c_panel { 7 | public: 8 | const char * get_name ( unsigned int vgui_panel ) { 9 | using get_name_fn = const char * ( __thiscall * )( void * , unsigned int ); 10 | return shared::memory::v_func< get_name_fn > ( this , 36 )( this , vgui_panel ); 11 | } 12 | }; 13 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/prediction.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "user_cmd.hh" 4 | 5 | namespace sdk::valve { 6 | class c_move_helper { 7 | private: 8 | virtual void _vpad ( ) = 0; 9 | public: 10 | virtual void set_host ( void * host ) = 0; 11 | private: 12 | virtual void unknown1 ( ) = 0; 13 | virtual void unknown2 ( ) = 0; 14 | public: 15 | virtual bool process_impacts ( ) = 0; 16 | }; 17 | 18 | struct movedata_t { 19 | public: 20 | bool m_bfirstrunoffunctions : 1; 21 | bool m_bgamecodemovedplayer : 1; 22 | bool m_bnoaircontrol : 1; 23 | void* m_nplayerhandle; // edict index on server, client entity handle on client 24 | int m_nimpulsecommand; // impulse command issued. 25 | c_vector3 m_vecviewangles; // command view angles (local space) 26 | c_vector3 m_vecabsviewangles; // command view angles (world space) 27 | int m_nbuttons; // attack buttons. 28 | int m_noldbuttons; // from host_client->oldbuttons; 29 | float m_flforwardmove; 30 | float m_flsidemove; 31 | float m_flupmove; 32 | float _m_flmaxspeed; 33 | float m_flclientmaxspeed; 34 | // variables from the player edict (sv_player) or entvars on the client. 35 | // these are copied in here before calling and copied out after calling. 36 | c_vector3 m_vecvelocity_; // edict::velocity // current movement direction. 37 | c_vector3 m_vecoldvelocity; 38 | float somefloat; 39 | c_vector3 m_vecangles; // edict::angles 40 | c_vector3 m_vecoldangles; 41 | // output only 42 | float m_outstepheight; // how much you climbed this move 43 | c_vector3 m_outwishvel; // this is where you tried 44 | c_vector3 m_outjumpvel; // this is your jump velocity 45 | // movement constraints (radius 0 means no constraint) 46 | c_vector3 m_vecconstraintcenter; 47 | float m_flconstraintradius; 48 | float m_flconstraintwidth; 49 | float m_flconstraintspeedfactor; 50 | bool m_bconstraintpastradius; ///< if no, do no constraining past radius. if yes, cap them to speedfactor past radius 51 | void setabsorigin ( const c_vector3 & vec ); 52 | const c_vector3 & getabsorigin ( ) const; 53 | public: 54 | c_vector3 _m_vecabsorigin; // edict::origin 55 | //pad ( 184 ) 56 | }; 57 | 58 | class c_game_movement { 59 | public: 60 | virtual ~c_game_movement ( void ) { } 61 | 62 | virtual void process_movement ( void * player , movedata_t * movement ) = 0; 63 | virtual void reset ( void ) = 0; 64 | virtual void start_track_prediction_errors ( void * player ) = 0; 65 | virtual void finish_track_prediction_errors ( void * player ) = 0; 66 | virtual void difference_print ( char const * fmt , ... ) = 0; 67 | virtual c_vector3 const & player_minimums ( bool ducked ) const = 0; 68 | virtual c_vector3 const & player_maximums ( bool ducked ) const = 0; 69 | virtual c_vector3 const & player_view_offset ( bool ducked ) const = 0; 70 | virtual bool is_moving_player_stuck ( void ) const = 0; 71 | virtual void * get_moving_player ( void ) const = 0; 72 | virtual void unblock_pusher ( void * player , void * pusher ) = 0; 73 | virtual void setup_movement_bounds ( movedata_t * movement ) = 0; 74 | }; 75 | 76 | class c_prediction { 77 | public: 78 | virtual ~c_prediction ( void ) = 0; 79 | virtual void initialize ( void ) = 0; 80 | virtual void shutdown ( void ) = 0; 81 | public: 82 | virtual void update ( int startframe , bool validframe , int incoming_acknowledged , int outgoing_command ); 83 | virtual void pre_entity_packet_recieved ( int commands_acknowledged , int current_world_update_packet ); 84 | virtual void post_entity_packet_recieved ( void ); 85 | virtual void post_network_data_recieved ( int commands_acknowledged ); 86 | virtual void on_recieve_uncompressed_packed ( void ); 87 | virtual void get_view_origin ( c_vector3 & org ); 88 | virtual void set_view_origin ( c_vector3 & org ); 89 | virtual void get_view_angles ( c_vector3 & ang ); 90 | virtual void set_view_angles ( c_vector3 & ang ); 91 | virtual void get_local_view_angles ( c_vector3 & ang ); 92 | virtual void set_local_view_angles ( c_vector3 & ang ); 93 | virtual bool in_prediction ( void ) const; 94 | virtual bool is_first_time_predicted ( void ) const; 95 | virtual int get_last_acknowledged_cmd_number ( void ) const; 96 | virtual int get_incoming_packet_number ( void ) const; 97 | virtual void check_moving_ground ( void * player , double frametime ); 98 | virtual void run_command ( void * player , void * cmd , c_move_helper * moveHelper ); 99 | virtual void setup_move ( void * player , void * cmd , c_move_helper * helper , movedata_t * movement ); 100 | virtual void finish_move ( void * player , void * cmd , movedata_t * movement ); 101 | virtual void set_ideal_pitch ( int slot , void * player , const c_vector3 & origin , const c_vector3 & angles , const c_vector3 & viewheight ); 102 | virtual void check_error ( int slot , void * player , int commands_acknowledged ); 103 | public: 104 | virtual void _update ( int nSlot , bool received_new_world_update , bool validframe , int incoming_acknowledged , int outgoing_command ); 105 | bool perform_prediction ( int slot , void * local_player , bool received_new_world_update , int incoming_acknowledged , int outgoing_command ); 106 | void shift_intermediate_data_forward ( int slot , int slots_to_remove , int previous_last_slot ); 107 | void restore_entity_to_predicted_frame ( int slot , int predicted_frame ); 108 | int first_command_to_execute ( int slot , bool received_new_world_update , int incoming_acknowledged , int outgoing_command ); 109 | void dump_entity ( void * ent , int commands_acknowledged ); 110 | void shutdown_predictables ( void ); 111 | void reinit_predictables ( void ); 112 | void remove_stale_predicted_entities ( int slot , int last_command_packet ); 113 | void restore_original_ent_state ( int slot ); 114 | void run_simulation ( int current_command , float curtime , ucmd_t * cmd , void * local_player ); 115 | void untouch ( int slot ); 116 | void store_prediction_results ( int slot , int predicted_frame ); 117 | bool should_dump_entity ( void * ent ); 118 | void smooth_view_on_moving_platform ( void * player , c_vector3 & offset ); 119 | void reset_simulation_tick ( ); 120 | void show_prediction_list_entry ( int list_row , int show_list , void * ent , int & totalsize , int & totalsize_intermediate ); 121 | void finish_prediction_list ( int list_row , int show_list , int totalsize , int totalsize_intermediate ); 122 | void check_predict_convar ( ); 123 | 124 | /* values */ 125 | pad ( 8 ) 126 | bool m_in_prediction; 127 | pad ( 1 ) 128 | bool m_engine_paused; 129 | pad ( 13 ) 130 | bool m_is_first_time_predicted; 131 | }; 132 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/render_view.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/matrix3x4.hh" 4 | 5 | #include "../../shared/color/color.hh" 6 | #include "../../shared/memory/memory.hh" 7 | 8 | namespace sdk::valve { 9 | struct mdlrender_info_t { 10 | c_vector3 m_origin; 11 | c_vector3 m_angles; 12 | pad ( 4 ); 13 | void * m_renderable; 14 | const void * m_model; 15 | c_matrix3x4 * m_model_to_world; 16 | c_matrix3x4 * m_lighting_offset; 17 | c_vector3 * m_lighting_origin; 18 | int m_flags; 19 | int m_entity_index; 20 | int m_skin; 21 | int m_body; 22 | int m_hitbox_set; 23 | std::uint16_t m_instance; 24 | }; 25 | 26 | class c_renderview { 27 | public: 28 | void set_blend ( float blend ) { 29 | using setblend_fn = void ( __thiscall * )( void * , float ); 30 | shared::memory::v_func< setblend_fn > ( this , 4 )( this , ( float ) blend / 255.0f ); 31 | } 32 | 33 | void color_modulate ( c_color clr ) { 34 | using colormodulate_fn = void ( __thiscall * )( void * , float * ); 35 | float clrf [ ] { ( float ) clr.r / 255.0f, ( float ) clr.g / 255.0f, ( float ) clr.b / 255.0f }; 36 | shared::memory::v_func< colormodulate_fn > ( this , 6 )( this , clrf ); 37 | } 38 | }; 39 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/surface.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/vector.hh" 4 | 5 | #include "../../shared/color/color.hh" 6 | #include "../../shared/memory/memory.hh" 7 | 8 | namespace sdk::valve { 9 | namespace vgui { 10 | typedef unsigned long hfont; 11 | typedef unsigned int vpanel; 12 | }; 13 | 14 | enum font_feature { 15 | font_feature_antialiased_fonts = 1 , font_feature_dropshadow_fonts = 2 , font_feature_outline_fonts = 6 16 | }; 17 | 18 | enum font_draw_type { 19 | font_draw_default = 0 , font_draw_nonadditive , font_draw_additive , font_draw_type_count = 2 20 | }; 21 | 22 | enum font_flags { 23 | fontflag_none , 24 | fontflag_italic = 0x001 , 25 | fontflag_underline = 0x002 , 26 | fontflag_strikeout = 0x004 , 27 | fontflag_symbol = 0x008 , 28 | fontflag_antialias = 0x010 , 29 | fontflag_gaussianblur = 0x020 , 30 | fontflag_rotary = 0x040 , 31 | fontflag_dropshadow = 0x080 , 32 | fontflag_additive = 0x100 , 33 | fontflag_outline = 0x200 , 34 | fontflag_custom = 0x400 , 35 | fontflag_bitmap = 0x800 36 | }; 37 | 38 | struct vert_t { 39 | vert_t ( ) = default; 40 | 41 | vert_t ( const c_vector2 & pos , const c_vector2 & coord = c_vector2 ( 0 , 0 ) ) 42 | : m_pos ( pos ) , m_coord ( coord ) { }; 43 | 44 | void init ( const c_vector2 & pos , const c_vector2 & coord = c_vector2 ( 0 , 0 ) ) { 45 | m_pos = pos; 46 | m_coord = coord; 47 | }; 48 | 49 | c_vector2 m_pos; 50 | c_vector2 m_coord; 51 | }; 52 | 53 | class c_surface { 54 | public: 55 | void draw_set_color ( c_color col ) { 56 | using fn = void ( __thiscall * )( void * , int , int , int , int ); 57 | shared::memory::v_func ( this , 15 )( this , col.r , col.g , col.b , col.a ); 58 | } 59 | 60 | void draw_filled_rect ( int x , int y , int w , int h ) { 61 | using fn = void ( __thiscall * )( void * , int , int , int , int ); 62 | shared::memory::v_func ( this , 16 )( this , x , y , x + w , y + h ); 63 | } 64 | 65 | void draw_outlined_rect ( int x , int y , int w , int h ) { 66 | using fn = void ( __thiscall * )( void * , int , int , int , int ); 67 | shared::memory::v_func ( this , 18 )( this , x , y , x + w , y + h ); 68 | } 69 | 70 | void draw_line ( int x , int y , int x1 , int y1 ) { 71 | using fn = void ( __thiscall * )( void * , int , int , int , int ); 72 | shared::memory::v_func ( this , 19 )( this , x , y , x1 , y1 ); 73 | } 74 | 75 | void draw_set_texture ( int id ) { 76 | using fn = void ( __thiscall * )( void * , int ); 77 | shared::memory::v_func ( this , 38 )( this , id ); 78 | } 79 | 80 | bool is_texture_id_valid ( int id ) { 81 | using fn = bool ( __thiscall * )( void * , int ); 82 | return shared::memory::v_func ( this , 42 )( this , id ); 83 | } 84 | 85 | int create_new_texture_id ( bool procedural = false ) { 86 | using fn = int ( __thiscall * )( void * , bool ); 87 | return shared::memory::v_func ( this , 43 )( this , procedural ); 88 | } 89 | 90 | void unlock_cursor ( ) { 91 | using fn = void ( __thiscall * )( void * ); 92 | shared::memory::v_func ( this , 66 )( this ); 93 | } 94 | 95 | void lock_cursor ( ) { 96 | using fn = void ( __thiscall * )( void * ); 97 | shared::memory::v_func ( this , 67 )( this ); 98 | } 99 | 100 | vgui::hfont create_font ( ) { 101 | using fn = vgui::hfont ( __thiscall * )( void * ); 102 | return shared::memory::v_func ( this , 71 )( this ); 103 | } 104 | 105 | bool set_font_glyph ( vgui::hfont font , const char * name , int tall , int weight , int blur , int scanlines , int flags , int range_minimum = 0 , int range_maximum = 0 ) { 106 | using fn = bool ( __thiscall * )( void * , vgui::hfont , const char * , int , int , int , int , int , int , int ); 107 | return shared::memory::v_func ( this , 72 )( this , font , name , tall , weight , blur , scanlines , flags , range_minimum , range_maximum ); 108 | } 109 | 110 | void get_text_size ( vgui::hfont font , const wchar_t * text , int & wide , int & tall ) { 111 | using fn = void ( __thiscall * )( void * , vgui::hfont , const wchar_t * , int & , int & ); 112 | shared::memory::v_func ( this , 79 )( this , font , text , wide , tall ); 113 | } 114 | 115 | void play_sound ( const char * sound ) { 116 | using fn = void ( __thiscall * )( void * , const char * ); 117 | shared::memory::v_func ( this , 82 )( this , sound ); 118 | } 119 | 120 | void draw_textured_polygon ( int count , vert_t * verts , bool clip = true ) { 121 | using fn = void ( __thiscall * )( void * , int , vert_t * , bool ); 122 | shared::memory::v_func ( this , 106 )( this , count , verts , clip ); 123 | } 124 | 125 | void draw_fade_rectangle ( int x , int y , int w , int h , std::uint32_t alpha0 , std::uint32_t alpha1 , bool horizontal ) { 126 | using fn = void ( __thiscall * )( void * , int , int , int , int , std::uint32_t , std::uint32_t , bool ); 127 | shared::memory::v_func< fn > ( this , 123 )( this , x , y , x + w , y + h , alpha0 , alpha1 , horizontal ); 128 | } 129 | 130 | void get_clip_rectangle ( int & x , int & y , int & x1 , int & y1 ) { 131 | using fn = void ( __thiscall * )( void * , int & , int & , int & , int & ); 132 | shared::memory::v_func ( this , 146 )( this , x , y , x1 , y1 ); 133 | } 134 | 135 | void set_clip_rectangle ( int x , int y , int x1 , int y1 ) { 136 | using fn = void ( __thiscall * )( void * , int , int , int , int ); 137 | shared::memory::v_func ( this , 147 )( this , x , y , x1 , y1 ); 138 | } 139 | 140 | void draw_circle ( int x , int y , float radius , int r , int g , int b , int a ) { 141 | using fn = void ( __thiscall * )( void * , int , int , float , int , int , int , int ); 142 | shared::memory::v_func ( this , 163 )( this , x , y , radius , r , g , b , a ); 143 | } 144 | 145 | void draw_text ( vgui::hfont font , int x , int y , int r , int g , int b , int a , const char * txt ) { 146 | using fn = void ( __thiscall * )( void * , vgui::hfont , int , int , int , int , int , int , const char * , const char * ); 147 | shared::memory::v_func ( this , 164 )( this , font , x , y , r , g , b , a , txt , nullptr ); 148 | } 149 | }; 150 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/surface_props.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define char_tex_concrete 'C' 4 | #define char_tex_metal 'M' 5 | #define char_tex_dirt 'D' 6 | #define char_tex_vent 'V' 7 | #define char_tex_grate 'G' 8 | #define char_tex_tile 'T' 9 | #define char_tex_slosh 'S' 10 | #define char_tex_wood 'W' 11 | #define char_tex_computer 'P' 12 | #define char_tex_glass 'Y' 13 | #define char_tex_flesh 'F' 14 | #define char_tex_snow 'N' 15 | #define char_tex_plastic 'L' 16 | #define char_tex_cardboard 'U' 17 | 18 | namespace sdk::valve { 19 | struct surfacephysicsparams { 20 | float friction; 21 | float elasticity; 22 | float density; 23 | float thickness; 24 | float dampening; 25 | }; 26 | 27 | struct surfaceaudioparams { 28 | float reflectivity; 29 | float hardness_factor; 30 | float roughness_factor; 31 | float rough_threshold; 32 | float hard_threshold; 33 | float hard_velocity_threshold; 34 | float high_pitch_occlusion; 35 | float mid_pitch_occlusion; 36 | float low_pitch_occlusion; 37 | }; 38 | 39 | struct surfacesoundnames { 40 | unsigned short walk_step_left; 41 | unsigned short walk_step_right; 42 | unsigned short run_step_left; 43 | unsigned short run_step_right; 44 | unsigned short impact_soft; 45 | unsigned short impact_hard; 46 | unsigned short scrape_smooth; 47 | unsigned short scrape_rough; 48 | unsigned short bullet_impact; 49 | unsigned short rolling; 50 | unsigned short break_sound; 51 | unsigned short strain_sound; 52 | }; 53 | 54 | struct surfacegameprops_t { 55 | float maxspeedfactor; 56 | float jumpfactor; 57 | float penetration_mod; 58 | float damage_mod; 59 | unsigned short material; 60 | unsigned char climbable; 61 | }; 62 | 63 | struct surfacedata_t { 64 | surfacephysicsparams physics; 65 | surfaceaudioparams audio; 66 | surfacesoundnames sounds; 67 | surfacegameprops_t game; 68 | char pad [ 48 ]; 69 | }; 70 | 71 | class c_surface_props { 72 | public: 73 | virtual ~c_surface_props ( ) = default; 74 | virtual int parse_surface_data ( const char * filename , const char * textfile ) = 0; 75 | virtual int surface_prop_count ( ) const = 0; 76 | virtual int get_surface_index ( const char * surface_prop_name ) const = 0; 77 | virtual void get_physics_properties ( int surface_data_index , float * density , float * thickness , float * friction , float * elasticity ) const = 0; 78 | virtual surfacedata_t * get_surface_data ( int surface_data_index ) = 0; 79 | virtual const char * get_string ( unsigned short string_table_index ) const = 0; 80 | virtual const char * get_prop_name ( int surface_data_index ) const = 0; 81 | virtual void set_world_material_index_table ( int * map_array , int map_size ) = 0; 82 | virtual void get_physics_parameters ( int surface_data_index , surfacephysicsparams * params_out ) const = 0; 83 | }; 84 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/user_cmd.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/vector.hh" 4 | 5 | #include "../../shared/memory/memory.hh" 6 | 7 | namespace sdk::valve { 8 | enum cmd_buttons { 9 | in_attack = ( 1 << 0 ) , 10 | in_jump = ( 1 << 1 ) , 11 | in_duck = ( 1 << 2 ) , 12 | in_forward = ( 1 << 3 ) , 13 | in_back = ( 1 << 4 ) , 14 | in_use = ( 1 << 5 ) , 15 | in_cancel = ( 1 << 6 ) , 16 | in_left = ( 1 << 7 ) , 17 | in_right = ( 1 << 8 ) , 18 | in_moveleft = ( 1 << 9 ) , 19 | in_moveright = ( 1 << 10 ) , 20 | in_attack2 = ( 1 << 11 ) , 21 | in_run = ( 1 << 12 ) , 22 | in_reload = ( 1 << 13 ) , 23 | in_alt1 = ( 1 << 14 ) , 24 | in_alt2 = ( 1 << 15 ) , 25 | in_score = ( 1 << 16 ) , 26 | in_speed = ( 1 << 17 ) , 27 | in_walk = ( 1 << 18 ) , 28 | in_zoom = ( 1 << 19 ) , 29 | in_weapon1 = ( 1 << 20 ) , 30 | in_weapon2 = ( 1 << 21 ) , 31 | in_bullrush = ( 1 << 22 ) , 32 | in_grenade1 = ( 1 << 23 ) , 33 | in_grenade2 = ( 1 << 24 ) , 34 | in_attack3 = ( 1 << 25 ) 35 | }; 36 | 37 | struct ucmd_t { 38 | pad ( 4 ); 39 | int m_cmdnum; 40 | int m_tickcount; 41 | c_vector3 m_angs; 42 | c_vector3 m_aimdir; 43 | float m_fmove; 44 | float m_smove; 45 | float m_umove; 46 | int m_buttons; 47 | unsigned char m_impulse; 48 | int m_weaponselect; 49 | int m_weaponsubtype; 50 | int m_randseed; 51 | short m_mousedx; 52 | short m_mousedy; 53 | bool m_hasbeenpredicted; 54 | pad ( 24 ); 55 | 56 | void reset ( ) { 57 | this->m_cmdnum = 0; 58 | this->m_tickcount = 0; 59 | this->m_angs = c_vector3 ( 0.f , 0.f , 0.f ); 60 | this->m_fmove = 0.0f; 61 | this->m_smove = 0.0f; 62 | this->m_umove = 0.0f; 63 | this->m_buttons = 0; 64 | this->m_impulse = 0; 65 | this->m_weaponselect = 0; 66 | this->m_weaponsubtype = 0; 67 | this->m_randseed = 0; 68 | this->m_mousedx = 0; 69 | this->m_mousedy = 0; 70 | this->m_hasbeenpredicted = false; 71 | } 72 | }; 73 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/valve_vector.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace sdk::valve { 4 | class c_util_vector { 5 | public: 6 | unsigned memory; 7 | private: 8 | char pad [ 8 ]; 9 | public: 10 | unsigned int count; 11 | unsigned elements; 12 | 13 | inline void * base ( ) { 14 | return ( void * ) memory; 15 | } 16 | 17 | inline int get_count ( ) { 18 | return count; 19 | } 20 | }; 21 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/valve/view_render_beams.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/vector.hh" 4 | 5 | #include "../../shared/memory/memory.hh" 6 | 7 | namespace sdk::valve { 8 | enum { 9 | TE_BEAMPOINTS = 0 , 10 | TE_SPRITE = 1 , 11 | TE_BEAMDISK = 2 , 12 | TE_BEAMCYLINDER = 3 , 13 | TE_BEAMFOLLOW = 4 , 14 | TE_BEAMRING = 5 , 15 | TE_bmsPLINE = 6 , 16 | TE_BEAMRINGPOINT = 7 , 17 | TE_BEAMLASER = 8 , 18 | TE_BEAMTESLA = 9 19 | }; 20 | 21 | enum { 22 | FBEAM_STARTENTITY = 0x00000001 , 23 | FBEAM_ENDENTITY = 0x00000002 , 24 | FBEAM_FADEIN = 0x00000004 , 25 | FBEAM_FADEOUT = 0x00000008 , 26 | FBEAM_SINENOISE = 0x00000010 , 27 | FBEAM_SOLID = 0x00000020 , 28 | FBEAM_SHADEIN = 0x00000040 , 29 | FBEAM_SHADEOUT = 0x00000080 , 30 | FBEAM_ONLYNOISEONCE = 0x00000100 , // Only calculate our noise once 31 | FBEAM_NOTILE = 0x00000200 , 32 | FBEAM_USE_HITBOXES = 0x00000400 , // Attachment indices represent hitbox indices instead when this is set. 33 | FBEAM_STARTVISIBLE = 0x00000800 , // Has this client actually seen this beam's start entity yet? 34 | FBEAM_ENDVISIBLE = 0x00001000 , // Has this client actually seen this beam's end entity yet? 35 | FBEAM_ISACTIVE = 0x00002000 , 36 | FBEAM_FOREVER = 0x00004000 , 37 | FBEAM_HALOBEAM = 0x00008000 , // When drawing a beam with a halo, don't ignore the segments and endwidth 38 | FBEAM_REVERSED = 0x00010000 , 39 | NUM_BEAM_FLAGS = 17 40 | }; 41 | 42 | struct beam_trail_t { 43 | beam_trail_t * next; 44 | float die; 45 | c_vector3 org; 46 | c_vector3 vel; 47 | }; 48 | 49 | class c_beam { 50 | public: 51 | pad ( 224 ) /* 0 */ 52 | float m_flred; /* 224 */ 53 | float m_flgreen; /* 228 */ 54 | float m_flblue; /* 232 */ 55 | pad ( 8 ) /* 236 */ 56 | float m_flframerate; /* 244 */ 57 | int m_nstartframe; /* 248 */ 58 | }; 59 | 60 | struct beam_info_t { 61 | int m_ntype; /* 0 */ 62 | void * m_pstartent; /* 4 */ 63 | int m_nstartattachment; /* 8 */ 64 | void * m_pendent; /* 12 */ 65 | int m_nendattachment; /* 16 */ 66 | c_vector3 m_vecstart; /* 20 */ 67 | c_vector3 m_vecend; /* 32 */ 68 | int m_nmodelindex; /* 44 */ 69 | const char * m_pszmodelname; /* 48 */ 70 | int m_nhaloindex; /* 52 */ 71 | const char * m_pszhaloname; /* 56 */ 72 | float m_flhaloscale; /* 60 */ 73 | float m_fllife; /* 64 */ 74 | float m_flwidth; /* 68 */ 75 | float m_flendwidth; /* 72 */ 76 | float m_flfadelength; /* 76 */ 77 | float m_flamplitude; /* 80 */ 78 | float m_flbrightness; /* 84 */ 79 | float m_flspeed; /* 88 */ 80 | int m_nstartframe; /* 92 */ 81 | float m_flframerate; /* 96 */ 82 | float m_flred; /* 100 */ 83 | float m_flgreen; /* 104 */ 84 | float m_flblue; /* 108 */ 85 | bool m_brenderable; /* 112 */ 86 | int m_nsegments; /* 113 */ 87 | int m_nflags; /* 117 */ 88 | c_vector3 m_veccenter; /* 121 */ 89 | float m_flstartradius; /* 133 */ 90 | float m_flendradius; /* 137 */ 91 | 92 | beam_info_t ( ) { 93 | m_ntype = TE_BEAMPOINTS; 94 | m_nsegments = -1; 95 | m_pszmodelname = 0; 96 | m_pszhaloname = 0; 97 | m_nmodelindex = -1; 98 | m_nhaloindex = -1; 99 | m_brenderable = true; 100 | m_nflags = 0; 101 | } 102 | }; 103 | 104 | class c_view_render_beams { 105 | public: 106 | void draw_beam ( sdk::valve::c_beam * beam ) { 107 | /* sig: client_panorama , 55 8B EC 83 E4 F8 83 EC 28 89 4C 24 0C */ 108 | /* xref: "CViewRenderBeams::DrawBeam: Unknown beam type %i\n" */ 109 | using fn = void ( __thiscall * )( void * , c_beam * ); 110 | shared::memory::v_func< fn > ( this , 4 )( this , beam ); 111 | } 112 | 113 | sdk::valve::c_beam * create_beam ( sdk::valve::beam_info_t & beam ) { 114 | /* sig: 55 8B EC 56 8B 75 08 0F 57 C9 57 8B F9 F3 0F 10 46 ? 0F 2E C1 9F F6 C4 44 7B 17 */ 115 | /* no xref */ 116 | using fn = c_beam * ( __thiscall * )( void * , beam_info_t & ); 117 | return shared::memory::v_func< fn > ( this , 12 )( this , beam ); 118 | } 119 | }; 120 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/sdk/weapon.cc: -------------------------------------------------------------------------------- 1 | #include "weapon.hh" 2 | 3 | #include "../hack/game/interfaces.hh" 4 | 5 | sdk::c_weaponinfo * sdk::c_weapon::data ( ) { 6 | if ( !this ) 7 | return nullptr; 8 | 9 | static auto dataidx = 460; 10 | return shared::memory::v_func< sdk::c_weaponinfo * ( __thiscall * )( void * ) > ( this , dataidx )( this ); 11 | } 12 | 13 | /* xref: "Inaccuracy =\t%f\tSpread =\t%f\tSpreadDistance =\t%f\tPlayer Velocity =\t%f\n" */ 14 | float sdk::c_weapon::inaccuracy ( ) { 15 | static auto getinaccuracy_idx = 482; 16 | return shared::memory::v_func< float ( __thiscall * )( void * ) > ( this , getinaccuracy_idx )( this ); 17 | } 18 | 19 | float sdk::c_weapon::spread ( ) { 20 | static auto getspread_idx = 452; 21 | return shared::memory::v_func< float ( __thiscall * )( void * ) > ( this , getspread_idx )( this ); 22 | } 23 | 24 | void sdk::c_weapon::update_accuracy ( ) { 25 | static auto updateaccuracy_idx = 483; 26 | shared::memory::v_func< void ( __thiscall * )( void * ) > ( this , updateaccuracy_idx )( this ); 27 | } 28 | -------------------------------------------------------------------------------- /lunar_csgo_recode/shared/color/color.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class c_color { 5 | public: 6 | int r , g , b , a; 7 | 8 | constexpr c_color ( ) : r ( 255 ) , g ( 255 ) , b ( 255 ) , a ( 255 ) { } 9 | constexpr c_color ( int r_ , int g_ , int b_ , int a_ = 255 ) : r ( r_ ) , g ( g_ ) , b ( b_ ) , a ( a_ ) { } 10 | 11 | static float hue_to_rgb ( float v1 , float v2 , float v_h ) { 12 | if ( v_h < 0 ) 13 | v_h += 1; 14 | 15 | if ( v_h > 1 ) 16 | v_h -= 1; 17 | 18 | if ( ( 6 * v_h ) < 1 ) 19 | return ( v1 + ( v2 - v1 ) * 6 * v_h ); 20 | 21 | if ( ( 2 * v_h ) < 1 ) 22 | return v2; 23 | 24 | if ( ( 3 * v_h ) < 2 ) 25 | return ( v1 + ( v2 - v1 ) * ( ( 2.0f / 3 ) - v_h ) * 6 ); 26 | 27 | return v1; 28 | } 29 | 30 | static std::uint32_t to_d3d ( const c_color & col ) { 31 | return D3DCOLOR_RGBA ( col.r , col.g , col.b , col.a ); 32 | } 33 | 34 | static c_color from_hsv ( float hue , float sat , float l ) { 35 | unsigned char r = 0; 36 | unsigned char g = 0; 37 | unsigned char b = 0; 38 | 39 | if ( sat == 0 ) { 40 | r = g = b = ( unsigned char ) ( l * 255 ); 41 | } else { 42 | float v1 , v2; 43 | 44 | float huexd = ( float ) hue / 360; 45 | while ( huexd > 1.1f ) 46 | huexd = ( float ) hue / 360; 47 | 48 | v2 = ( l < 0.5 ) ? ( l * ( 1 + sat ) ) : ( ( l + sat ) - ( l * sat ) ); 49 | v1 = 2 * l - v2; 50 | 51 | r = ( unsigned char ) ( 255 * hue_to_rgb ( v1 , v2 , huexd + ( 1.0f / 3 ) ) ); 52 | g = ( unsigned char ) ( 255 * hue_to_rgb ( v1 , v2 , huexd ) ); 53 | b = ( unsigned char ) ( 255 * hue_to_rgb ( v1 , v2 , huexd - ( 1.0f / 3 ) ) ); 54 | } 55 | 56 | return c_color ( r , g , b , 255.f ); 57 | } 58 | }; -------------------------------------------------------------------------------- /lunar_csgo_recode/shared/hooking/hooking.hh: -------------------------------------------------------------------------------- 1 | /* multi purpose hooking class written by swoopae */ 2 | /* includes the ability to vmt and detour hook */ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace multihook { 10 | enum e_hooktype { 11 | HOOK_VMT = 0, 12 | HOOK_DETOUR 13 | }; 14 | 15 | struct vmt_t { 16 | std::uintptr_t ** m_vmt_base , m_table_length , * original; 17 | }; 18 | 19 | class c_hook { 20 | private: 21 | /* members */ 22 | /* used for vmt */ 23 | 24 | /* used for detour */ 25 | }; 26 | } -------------------------------------------------------------------------------- /lunar_csgo_recode/shared/memory/memory.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* all memory stuff is tossed in here */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "../../external/hasher/hasher.hh" 14 | 15 | /* macros */ 16 | #define in_range(x,a,b) (x >= a && x <= b) 17 | 18 | #define get_bits( x ) (in_range((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (in_range(x,'0','9') ? x - '0' : 0)) 19 | #define get_byte( x ) (get_bits(x[0]) << 4 | get_bits(x[1])) 20 | 21 | #define combine( x, y ) x##y 22 | #define combine_two( x, y ) combine( x, y ) 23 | 24 | /* we only really use these three */ 25 | #define pad( sz ) \ 26 | private: \ 27 | unsigned char combine_two( pad_, __COUNTER__ )[ sz ]; \ 28 | public: 29 | 30 | #define sig( mod,sig ) \ 31 | shared::memory::get_signature ( GRAB_MODULE ( mod ) , sig ) 32 | 33 | #define ref_sig( mod,s ) \ 34 | shared::memory::get_func_addr_relative ( sig ( GRAB_MODULE ( mod ) , s ) ) 35 | 36 | #define x86reg void* ecx , void* edx 37 | #define x86regout ecx , edx 38 | 39 | namespace shared::memory { 40 | /* reference: https://www.unknowncheats.me/forum/2695607-post7.html ~swoopae */ 41 | static std::uintptr_t get_func_addr_relative ( std::uintptr_t address ) { 42 | const auto relative_addy = *reinterpret_cast< std::uintptr_t * >( std::uintptr_t ( address ) + 0x1 ); 43 | 44 | // calling address 45 | return std::uintptr_t ( address ) + 0x5 + relative_addy; 46 | } 47 | 48 | static std::uintptr_t get_signature ( std::uintptr_t sig_module , const std::string & signature ) { 49 | auto range_start = sig_module; 50 | 51 | MODULEINFO module_info; 52 | 53 | GetModuleInformation ( GetCurrentProcess ( ) , ( HMODULE ) range_start , &module_info , sizeof ( MODULEINFO ) ); 54 | 55 | int start = ( int ) module_info.lpBaseOfDll , len = module_info.SizeOfImage; 56 | 57 | uint8_t * scan_start , * scan_end; 58 | std::vector< std::pair< uint8_t , bool > > pattern {}; 59 | std::stringstream stream { signature }; 60 | std::string w; 61 | 62 | if ( !start || !len || signature.empty ( ) ) 63 | return{}; 64 | 65 | while ( stream >> w ) { 66 | if ( w [ 0 ] == '?' ) pattern.push_back ( { 0, true } ); 67 | else if ( std::isxdigit ( w [ 0 ] ) && std::isxdigit ( w [ 1 ] ) ) pattern.push_back ( { ( uint8_t ) std::strtoul ( w.data ( ), 0, 16 ), false } ); 68 | } 69 | 70 | scan_start = reinterpret_cast< uint8_t * >( start ); 71 | scan_end = scan_start + len; 72 | 73 | auto result = std::search ( scan_start , scan_end , pattern.begin ( ) , pattern.end ( ) , 74 | [ ] ( const uint8_t b , const std::pair< uint8_t , bool > & p ) { 75 | return b == p.first || p.second; 76 | } ); 77 | 78 | if ( result == scan_end ) 79 | return{}; 80 | 81 | return ( uintptr_t ) result; 82 | } 83 | 84 | template < typename t > 85 | __forceinline t v_func ( void * thisptr , std::uintptr_t v_index ) { 86 | if ( !thisptr ) { 87 | #if defined(_DEBUG) || defined(LUNAR_DEV) 88 | std::cout << "[ERROR] - couldn't find vfunc with index" << v_index << "\n"; 89 | throw std::exception ( std::string ( "couldn't find vfunc with index " + std::to_string ( v_index ) ).data ( ) ); 90 | #endif 91 | return *( t * )nullptr; 92 | } 93 | 94 | return t ( ( *( std::uintptr_t ** ) thisptr ) [ v_index ] ); 95 | } 96 | 97 | static std::int32_t rva_2_offset ( const std::uint32_t rva , PIMAGE_NT_HEADERS nt_headers , const bool in_memory = false ) { 98 | if ( !rva || !in_memory ) 99 | return rva; 100 | 101 | auto sec = IMAGE_FIRST_SECTION ( nt_headers ); 102 | for ( size_t i = 0; i < nt_headers->FileHeader.NumberOfSections; i++ ) { 103 | if ( rva >= sec->VirtualAddress && rva < sec->VirtualAddress + sec->Misc.VirtualSize ) 104 | break; 105 | sec++; 106 | } 107 | 108 | return rva - sec->VirtualAddress + sec->PointerToRawData; 109 | } 110 | 111 | static std::uintptr_t get_proc_address ( const std::uintptr_t module , const std::uint32_t function , const bool in_memory = false ) { 112 | const auto dos_headers = reinterpret_cast< IMAGE_DOS_HEADER * >( module ); 113 | if ( dos_headers->e_magic != IMAGE_DOS_SIGNATURE ) 114 | return 0; 115 | 116 | const auto nt_headers = reinterpret_cast< IMAGE_NT_HEADERS * >( dos_headers->e_lfanew + module ); 117 | if ( nt_headers->Signature != IMAGE_NT_SIGNATURE ) 118 | return 0; 119 | 120 | const auto exports = reinterpret_cast< IMAGE_EXPORT_DIRECTORY * >( 121 | rva_2_offset ( nt_headers->OptionalHeader.DataDirectory [ IMAGE_DIRECTORY_ENTRY_EXPORT ].VirtualAddress , 122 | nt_headers , in_memory ) + module ); 123 | 124 | const auto names = reinterpret_cast< std::uint32_t * >( rva_2_offset ( exports->AddressOfNames , nt_headers , in_memory ) + module ); 125 | 126 | auto ordinal_index = static_cast< std::uint32_t >( -1 ); 127 | for ( std::uint32_t i = 0; i < exports->NumberOfFunctions; i++ ) { 128 | const auto function_name = reinterpret_cast< const char * >( rva_2_offset ( names [ i ] , nt_headers , in_memory ) + module ); 129 | 130 | if ( fnv1a_rt ( function_name ) == function ) { 131 | ordinal_index = i; 132 | break; 133 | } 134 | } 135 | 136 | if ( ordinal_index > exports->NumberOfFunctions ) 137 | return 0; 138 | 139 | const auto ordinals = reinterpret_cast< std::uint16_t * >( rva_2_offset ( exports->AddressOfNameOrdinals , nt_headers , in_memory ) + module ); 140 | const auto addresses = reinterpret_cast< std::uint32_t * >( rva_2_offset ( exports->AddressOfFunctions , nt_headers , in_memory ) + module ); 141 | return rva_2_offset ( addresses [ ordinals [ ordinal_index ] ] , nt_headers , in_memory ) + module; 142 | } 143 | } --------------------------------------------------------------------------------