├── game_cfg ├── launch_options ├── listenserver.cfg ├── manifest └── appmanifest_240.acf ├── media ├── 360_hack.mp4 ├── 360_hack_thirdperson.mp4 ├── 2019-08-11 05-08-33 first esp.png └── 2019-08-11 23-46-00 bone visualization.png ├── facts ├── script ├── reinject.bash ├── patch_lib_sdl_dependency.bash ├── list_css_hack_debug_maps.bash ├── disable_ptrace_scope.bash ├── de_dust2.bash ├── css_with_hack.bash ├── build.bash ├── start_css.bash ├── eject.bash ├── inject.bash └── build_SDL.bash ├── lib └── windows │ └── SDL2-devel-2.0.10-VC │ └── SDL2-2.0.10 │ ├── include │ ├── SDL_revision.h │ ├── SDL_copying.h │ ├── SDL_opengles2_gl2platform.h │ ├── SDL_types.h │ ├── SDL_name.h │ ├── SDL_opengles.h │ ├── close_code.h │ ├── SDL_opengles2.h │ ├── SDL_test_memory.h │ ├── SDL_test_log.h │ ├── SDL_clipboard.h │ ├── SDL_test.h │ ├── SDL_quit.h │ ├── SDL_test_compare.h │ ├── SDL_gesture.h │ ├── SDL_test_images.h │ ├── SDL_error.h │ ├── SDL_power.h │ ├── SDL_test_font.h │ ├── SDL_config_minimal.h │ ├── SDL_loadso.h │ ├── SDL_touch.h │ ├── SDL_bits.h │ ├── SDL_test_random.h │ ├── SDL_config_wiz.h │ ├── SDL_test_assert.h │ ├── SDL_config_pandora.h │ ├── SDL_test_crc32.h │ └── SDL_timer.h │ ├── lib │ ├── x64 │ │ ├── SDL2.dll │ │ ├── SDL2.lib │ │ ├── SDL2main.lib │ │ └── SDL2test.lib │ └── x86 │ │ ├── SDL2.dll │ │ ├── SDL2.lib │ │ ├── SDL2main.lib │ │ └── SDL2test.lib │ ├── docs │ ├── README-platforms.md │ ├── README-wince.md │ ├── README-psp.md │ ├── README-pandora.md │ ├── README-hg.md │ ├── README-emscripten.md │ ├── README-cmake.md │ ├── README-porting.md │ ├── README.md │ ├── README-windows.md │ ├── README-directfb.md │ └── README-linux.md │ ├── sdl2-config.cmake │ ├── README-SDL.txt │ ├── BUGS.txt │ ├── README.txt │ └── COPYING.txt ├── .gitignore ├── src ├── unused │ ├── Keybindings.hpp │ ├── Weapon.hpp │ ├── pointers │ │ ├── ForeignPointerBuilderCRTP.cpp │ │ ├── ForeignPointerCRTP.cpp │ │ ├── PointersCRTP.hpp │ │ ├── Pointers.hpp │ │ ├── ForeignPointerBuilderCRTP.hpp │ │ ├── ForeignPointer.hpp │ │ ├── PointersCRTP.cpp │ │ ├── ForeignPointerBuilder_CompileTime.hpp │ │ ├── Pointers.cpp │ │ └── ForeignPointerCRTP.hpp │ └── ApiInterceptor.hpp ├── Hack.hpp ├── TemplateMagic.hpp ├── Detour.hpp ├── Bunnyhop.hpp ├── Pointers │ ├── libNames.hpp │ ├── GameVars.hpp │ ├── Signatures.hpp │ ├── overlay_structs.hpp │ ├── Offsets.hpp │ └── Signatures.cpp ├── Visuals │ ├── DrawHook.hpp │ ├── GuiElements.hpp │ ├── Gui_imgui_impl_sdl.h │ ├── DrawHook.cpp │ ├── GUI.hpp │ ├── Wallhack.hpp │ ├── ESP.hpp │ └── Wallhack.cpp ├── MemoryScanner │ ├── BoyerMooreSegmentScanner.hpp │ ├── LinearSegmentScanner.hpp │ └── RegexSegmentScanner.hpp ├── libEntry.hpp ├── RAIIHandle.hpp ├── CallDetour.hpp ├── MemoryUtils.cpp ├── Bunnyhop.cpp ├── DetourToCallback.hpp ├── Utility.hpp ├── Log.hpp ├── Utility.cpp ├── Aimbot.hpp ├── Log.cpp └── Input.hpp ├── .gitattributes ├── .vscode ├── tasks.json ├── c_cpp_properties.json ├── launch.json └── settings.json ├── .gitmodules ├── CMakeSettings.json ├── todo_features └── README.md /game_cfg/launch_options: -------------------------------------------------------------------------------- 1 | -novid -console +map de_dust2 +sv_lan 1 -insecure 2 | -------------------------------------------------------------------------------- /media/360_hack.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/media/360_hack.mp4 -------------------------------------------------------------------------------- /facts: -------------------------------------------------------------------------------- 1 | 2 | SDL compiled: 2.0.8 3 | SDL linked: 2.0.4 4 | 5 | OpenGL linked: 3.0 Mesa 19.0.2 -------------------------------------------------------------------------------- /media/360_hack_thirdperson.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/media/360_hack_thirdperson.mp4 -------------------------------------------------------------------------------- /media/2019-08-11 05-08-33 first esp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/media/2019-08-11 05-08-33 first esp.png -------------------------------------------------------------------------------- /media/2019-08-11 23-46-00 bone visualization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/media/2019-08-11 23-46-00 bone visualization.png -------------------------------------------------------------------------------- /script/reinject.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd into the script's directory 4 | cd "$(dirname "$0")" 5 | 6 | ./eject.bash 7 | ./inject.bash -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-12952:bc90ce38f1e2" 2 | #define SDL_REVISION_NUMBER 12952 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # clion 2 | .idea 3 | cmake-build-debug* 4 | cmake-build-release* 5 | 6 | # visual studio 7 | .vs 8 | out 9 | 10 | # vscode 11 | build 12 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2.dll -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2.lib -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2.dll -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2.lib -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2main.lib -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x64/SDL2test.lib -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2main.lib -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Therdel/cssHack/HEAD/lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/lib/x86/SDL2test.lib -------------------------------------------------------------------------------- /script/patch_lib_sdl_dependency.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd into the script's directory 4 | cd "$(dirname "$0")" 5 | 6 | patchelf --add-needed libSDL2-2.0.so.0 ../build/libcssHack.so -------------------------------------------------------------------------------- /src/unused/Keybindings.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define key_eject_comb_0 VK_LCONTROL 4 | #define key_eject_comb_1 0x51 5 | 6 | #define key_aim VK_SHIFT 7 | #define key_trigger VK_CAPITAL 8 | #define key_bhop VK_LMENU -------------------------------------------------------------------------------- /script/list_css_hack_debug_maps.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd into the script's directory 4 | cd "$(dirname "$0")" 5 | 6 | libraryPath=$(realpath "../build/libcssHack.so") 7 | grep $libraryPath "/proc/$(pidof hl2_linux)/maps" -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-platforms.md: -------------------------------------------------------------------------------- 1 | Platforms 2 | ========= 3 | 4 | We maintain the list of supported platforms on our wiki now, and how to 5 | build and install SDL for those platforms: 6 | 7 | https://wiki.libsdl.org/Installation 8 | 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | # source: https://help.github.com/en/articles/configuring-git-to-handle-line-endings 3 | * text=auto 4 | 5 | # github language statistics: Exclude foreign code 6 | lib/** linguist-vendored 7 | -------------------------------------------------------------------------------- /script/disable_ptrace_scope.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Check if script is run as root (sudo) 4 | if [ "$EUID" -ne 0 ]; then 5 | echo "Injection failed: Please run as root or use sudo." 6 | exit 1 7 | fi 8 | 9 | echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 10 | -------------------------------------------------------------------------------- /src/Hack.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define POLLS_PER_SECOND 100 6 | #define POLL_SLEEP_MS (1000/POLLS_PER_SECOND) 7 | 8 | // flag that tells if the hack should be terminated 9 | extern std::atomic_bool g_do_exit; 10 | 11 | auto hack_loop() -> void; 12 | -------------------------------------------------------------------------------- /script/de_dust2.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # source: https://aixxe.net/2016/12/internal-dev-environment 3 | 4 | width=1024 5 | height=768 6 | ~/.local/share/Steam/steamapps/common/Counter-Strike\ Source/hl2.sh -game cstrike -w$width -h$height -sw -novid -console -nobreakpad +sv_lan 1 +map de_dust2 7 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-wince.md: -------------------------------------------------------------------------------- 1 | WinCE 2 | ===== 3 | 4 | Windows CE is no longer supported by SDL. 5 | 6 | We have left the CE support in SDL 1.2 for those that must have it, and we 7 | have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3. 8 | 9 | --ryan. 10 | 11 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cmake", 6 | "label": "CMake: build", 7 | "command": "build", 8 | "targets": [ 9 | "all" 10 | ], 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | "problemMatcher": [], 16 | "detail": "CMake template build task" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /src/unused/Weapon.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct Weapon { 5 | uint8_t unknown_0[0xA0]; 6 | int id; 7 | uint8_t unknown_1[0x804]; 8 | int ammo; 9 | }; 10 | 11 | struct WeaponEntry { 12 | uintptr_t unknown_0; 13 | Weapon *weapon; 14 | uintptr_t unknown_1[2]; 15 | 16 | bool isPastEndEntry() const { 17 | return unknown_0 == 0; 18 | } 19 | }; -------------------------------------------------------------------------------- /game_cfg/listenserver.cfg: -------------------------------------------------------------------------------- 1 | sv_cheats 1 2 | bot_stop 1 3 | sv_showimpacts 3 4 | mp_freezetime 0 5 | mp_buytime 1000 6 | mp_roundtime 9 7 | mp_limitteams 30 8 | mp_startmoney 32000 9 | mp_autokick 0 10 | mp_autoteambalance 0 11 | sv_enablebunnyhopping 1 12 | sv_airaccelerate 100 13 | sv_wateraccelerate 100 14 | impulse 101 15 | cl_showpos 0 // this deactivates drawing opengl overlay somehow 16 | -------------------------------------------------------------------------------- /script/css_with_hack.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd into the script's directory 4 | cd "$(dirname "$0")" 5 | 6 | # libraryPath=$(realpath "../build/libcssHack.so") 7 | # export LD_PRELOAD=$libraryPath 8 | 9 | exec /home/theo/.local/share/Steam/steamapps/common/"Counter-Strike Source"/hl2.sh -steam -game cstrike -game cstrike -novid -console -nobreakpad +sv_lan 1 -map aim_ag_texture2.bsp -sw 10 | 11 | -------------------------------------------------------------------------------- /script/build.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd into the script's directory 4 | cd "$(dirname "$0")" 5 | 6 | # configure 7 | mkdir -p ../build 8 | cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ --no-warn-unused-cli -S.. -B../build 9 | 10 | # build 11 | cmake --build ../build --config Debug --target all -j -- 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/imgui"] 2 | path = lib/imgui 3 | url = https://github.com/ocornut/imgui 4 | [submodule "lib/glm"] 5 | path = lib/glm 6 | url = https://github.com/g-truc/glm 7 | [submodule "lib/BoyerMoore-DontCare"] 8 | path = lib/BoyerMoore-DontCare 9 | url = https://github.com/Therdel/BoyerMoore-DontCare 10 | branch = dontcare 11 | [submodule "lib/SDL"] 12 | path = lib/SDL 13 | url = https://github.com/libsdl-org/SDL.git 14 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-psp.md: -------------------------------------------------------------------------------- 1 | PSP 2 | ====== 3 | SDL port for the Sony PSP contributed by 4 | Captian Lex 5 | 6 | Credit to 7 | Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP 8 | Geecko for his PSP GU lib "Glib2d" 9 | 10 | Building 11 | -------- 12 | To build for the PSP, make sure psp-config is in the path and run: 13 | make -f Makefile.psp 14 | 15 | 16 | 17 | To Do 18 | ------ 19 | PSP Screen Keyboard 20 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/sdl2-config.cmake: -------------------------------------------------------------------------------- 1 | set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") 2 | 3 | # Support both 32 and 64 bit builds 4 | if (${CMAKE_SIZEOF_VOID_P} MATCHES 8) 5 | set(SDL2_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lib/x64/SDL2.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x64/SDL2main.lib") 6 | else () 7 | set(SDL2_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lib/x86/SDL2.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x86/SDL2main.lib") 8 | endif () 9 | 10 | string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/README-SDL.txt: -------------------------------------------------------------------------------- 1 | 2 | Please distribute this file with the SDL runtime environment: 3 | 4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library 5 | designed to make it easy to write multi-media software, such as games 6 | and emulators. 7 | 8 | The Simple DirectMedia Layer library source code is available from: 9 | https://www.libsdl.org/ 10 | 11 | This library is distributed under the terms of the zlib license: 12 | http://www.zlib.net/zlib_license.html 13 | 14 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/**" 7 | ], 8 | "defines": [], 9 | "compilerPath": "/usr/bin/clang", 10 | "cStandard": "c11", 11 | "cppStandard": "c++20", 12 | "intelliSenseMode": "linux-clang-x64", 13 | "configurationProvider": "ms-vscode.cmake-tools" 14 | } 15 | ], 16 | "version": 4 17 | } 18 | -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x86-Clang-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "buildRoot": "${projectDir}\\out\\build\\${name}", 8 | "installRoot": "${projectDir}\\out\\install\\${name}", 9 | "cmakeCommandArgs": "", 10 | "buildCommandArgs": "-v", 11 | "ctestCommandArgs": "", 12 | "inheritEnvironments": [ "clang_cl_x86" ], 13 | "variables": [], 14 | "intelliSenseMode": "windows-msvc-x86" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/BUGS.txt: -------------------------------------------------------------------------------- 1 | 2 | Bugs are now managed in the SDL bug tracker, here: 3 | 4 | https://bugzilla.libsdl.org/ 5 | 6 | You may report bugs there, and search to see if a given issue has already 7 | been reported, discussed, and maybe even fixed. 8 | 9 | 10 | You may also find help at the SDL forums/mailing list: 11 | 12 | https://discourse.libsdl.org/ 13 | 14 | Bug reports are welcome here, but we really appreciate if you use Bugzilla, as 15 | bugs discussed on the mailing list may be forgotten or missed. 16 | 17 | -------------------------------------------------------------------------------- /src/unused/pointers/ForeignPointerBuilderCRTP.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 04.09.19. 3 | // 4 | #include "ForeignPointerBuilderCRTP.hpp" 5 | 6 | namespace ForeignPtrBuilder { 7 | ForeignPtrBuilderBase base(uintptr_t rawAddress) { 8 | return {ForeignRawPtrBase(rawAddress)}; 9 | } 10 | 11 | ForeignPtrBuilderBase base(LibName const &libName) { 12 | return {ForeignLibraryPtrBase(libName)}; 13 | } 14 | 15 | template 16 | ForeignPtrBuilderBase base(BasePtr &basePtr) { 17 | return {basePtr}; 18 | } 19 | }; -------------------------------------------------------------------------------- /src/unused/pointers/ForeignPointerCRTP.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 04.09.19. 3 | // 4 | #include "ForeignPointerCRTP.hpp" 5 | 6 | #include "../../MemoryUtils.hpp" 7 | 8 | #define DEFAULT_LOG_CHANNEL Log::Channel::MESSAGE_BOX 9 | 10 | #include "../../Log.hpp" 11 | 12 | uintptr_t ForeignLibraryPtrBase::readLibraryBase() const { 13 | const auto libBase = MemoryUtils::get_lib_base_32(m_libName); 14 | if (!libBase.has_value()) { 15 | std::string error{m_libName.name() + " base addr not found"}; 16 | Log::log(error); 17 | throw std::runtime_error(error); 18 | } 19 | 20 | return *libBase; 21 | } -------------------------------------------------------------------------------- /src/unused/pointers/PointersCRTP.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 04.09.19. 3 | // 4 | #pragma once 5 | 6 | #include "ForeignPointerCRTP.hpp" 7 | #include "../../Vec3f.hpp" 8 | 9 | namespace PointersCRTP { 10 | auto localplayer() -> ForeignPtrOffset &; 11 | 12 | auto 13 | player_punch() -> ForeignPtrOffset, Vec3f> &; 14 | 15 | auto doAttack() -> ForeignPtrOffset &; 16 | 17 | auto op_on_update_viewAngle() -> ForeignPtrOffset &; 18 | 19 | auto op_on_update_viewAngleVis() -> ForeignPtrOffset &; 20 | } 21 | -------------------------------------------------------------------------------- /script/start_css.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # source: https://aixxe.net/2016/12/internal-dev-environment 3 | 4 | GAMEROOT=/home/theo/.local/share/Steam/steamapps/common/"Counter-Strike\ Source"/ 5 | export LD_LIBRARY_PATH="${GAMEROOT}"/bin:$LD_LIBRARY_PATH 6 | GAMEEXE=hl2_linux 7 | ulimit -n 2048 8 | export __GL_THREADED_OPTIMIZATIONS=1 9 | 10 | 11 | #cd "$GAMEROOT" 12 | "/home/theo/.local/share/Steam/steamapps/common/Counter-Strike\ Source/hl2_linux" -game cstrike -sw -novid -console -nobreakpad +sv_lan 1 -map aim_ag_texture2.bsp 13 | 14 | 15 | "${GAMEROOT}"/hl2_linux -game cstrike -sw -novid -console -nobreakpad +sv_lan 1 16 | 17 | "${GAMEROOT}"/hl2.sh -game cstrike -sw -novid -console -nobreakpad +sv_lan 1 18 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer 3 | 4 | (SDL) 5 | 6 | Version 2.0 7 | 8 | --- 9 | https://www.libsdl.org/ 10 | 11 | Simple DirectMedia Layer is a cross-platform development library designed 12 | to provide low level access to audio, keyboard, mouse, joystick, and graphics 13 | hardware via OpenGL and Direct3D. It is used by video playback software, 14 | emulators, and popular games including Valve's award winning catalog 15 | and many Humble Bundle games. 16 | 17 | More extensive documentation is available in the docs directory, starting 18 | with README.md 19 | 20 | Enjoy! 21 | Sam Lantinga (slouken@libsdl.org) 22 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-pandora.md: -------------------------------------------------------------------------------- 1 | Pandora 2 | ===================================================================== 3 | 4 | ( http://openpandora.org/ ) 5 | - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES 6 | support to work on the pandora under the framebuffer. This driver do not have 7 | input support for now, so if you use it you will have to add your own control code. 8 | The video driver name is "pandora" so if you have problem running it from 9 | the framebuffer, try to set the following variable before starting your application : 10 | "export SDL_VIDEODRIVER=pandora" 11 | 12 | - OpenGL ES support was added to the x11 driver, so it's working like the normal 13 | x11 driver one with OpenGLX support, with SDL input event's etc.. 14 | 15 | 16 | David Carré (Cpasjuste) 17 | cpasjuste@gmail.com 18 | -------------------------------------------------------------------------------- /src/TemplateMagic.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 06.09.19. 3 | // 4 | #pragma once 5 | #include 6 | 7 | struct OmittedType { 8 | }; 9 | 10 | template && 14 | !std::is_same_v, int> = 0> 15 | struct conditional_type_given { 16 | using type = typename std::conditional_t< 17 | std::is_same::value, 18 | TypeWhenOmitted, 19 | TypeWhenGiven>; 20 | }; 21 | 22 | template 25 | using conditional_type_given_t = typename conditional_type_given::type; -------------------------------------------------------------------------------- /src/Detour.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // uint8_t 4 | #include 5 | 6 | #include "Utility.hpp" 7 | 8 | class Detour : public Util::NonCopyable { 9 | public: 10 | Detour(); 11 | Detour(Detour &&other); 12 | ~Detour(); 13 | auto operator=(Detour &&other) noexcept -> Detour&; 14 | 15 | auto install(uintptr_t insertion_addr, 16 | int opcodes_len, 17 | uintptr_t detour_addr) -> bool; 18 | auto isEnabled() const -> bool; 19 | auto remove() -> bool; 20 | 21 | auto opcodes_len() const -> size_t; 22 | auto getJmpBackAddr() const -> uintptr_t; 23 | 24 | private: 25 | bool _enabled; 26 | uintptr_t _insertion_addr; 27 | std::vector _old_opcodes; 28 | 29 | /// cool stuff:opcode(s) with a jump to desired function 30 | auto _overwriteOpcodesWithDetour(uintptr_t detour_addr) const -> void; 31 | auto _restoreOldOpcodes() const -> void; 32 | }; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-hg.md: -------------------------------------------------------------------------------- 1 | Mercurial 2 | ========= 3 | 4 | The latest development version of SDL is available via Mercurial. 5 | Mercurial allows you to get up-to-the-minute fixes and enhancements; 6 | as a developer works on a source tree, you can use "hg" to mirror that 7 | source tree instead of waiting for an official release. Please look 8 | at the Mercurial website ( https://www.mercurial-scm.org/ ) for more 9 | information on using hg, where you can also download software for 10 | Mac OS X, Windows, and Unix systems. 11 | 12 | hg clone http://hg.libsdl.org/SDL 13 | 14 | If you are building SDL via configure, you will need to run autogen.sh 15 | before running configure. 16 | 17 | There is a web interface to the subversion repository at: 18 | http://hg.libsdl.org/SDL/ 19 | 20 | There is an RSS feed available at that URL, for those that want to 21 | track commits in real time. 22 | 23 | -------------------------------------------------------------------------------- /src/Bunnyhop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Utility.hpp" 4 | #include "DetourToCallback.hpp" 5 | #include "Pointers/GameVars.hpp" 6 | 7 | class Bunnyhop : public Util::NonCopyable, public Util::NonMovable { 8 | public: 9 | Bunnyhop(GameVars); 10 | // unhook 11 | ~Bunnyhop(); 12 | 13 | auto isEnabled() const -> bool; 14 | auto start() -> void; 15 | auto stop() -> void; 16 | 17 | private: 18 | GameVars gameVars; 19 | 20 | DetourToCallback m_detour_onGround_inc; 21 | DetourToCallback m_detour_onGround_dec; 22 | 23 | bool m_enabled; 24 | 25 | auto hook() -> void; 26 | auto unhook() -> void; 27 | 28 | // hook that gets called when the player lands on the ground 29 | // causes a +jump action 30 | auto hook_onGround_inc() -> void; 31 | 32 | // hook that gets called when the player leaves the ground 33 | // causes a -jump action 34 | auto hook_onGround_dec() -> void; 35 | }; -------------------------------------------------------------------------------- /src/unused/pointers/Pointers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 05.09.19. 3 | // 4 | #pragma once 5 | 6 | #include "GamePointer.hpp" 7 | #include "../Vec3f.hpp" 8 | #include "../Player.hpp" 9 | 10 | namespace Pointers { 11 | std::shared_ptr> const &localplayer(); 12 | 13 | std::shared_ptr> const &player_pos(); 14 | 15 | std::shared_ptr> const &player_angles(); 16 | 17 | std::shared_ptr> const &player_angles_vis(); 18 | 19 | std::shared_ptr> const &player_punch(); 20 | 21 | std::shared_ptr> const &player_team(); 22 | 23 | std::shared_ptr>> &players(); 24 | 25 | std::shared_ptr> &crosshair_target_id(); 26 | 27 | std::shared_ptr> const &doAttack(); 28 | 29 | std::shared_ptr> const &op_on_viewAngle_update(); 30 | 31 | std::shared_ptr> const &op_on_viewAngleVis_update(); 32 | } 33 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/COPYING.txt: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | -------------------------------------------------------------------------------- /src/Pointers/libNames.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 06.06.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace libNames { 9 | #ifdef __linux__ 10 | // TODO: Enum of std::string_views, name gotten by 11 | static constexpr std::string_view client = "client.so"; 12 | static constexpr std::string_view materialsystem = "materialsystem.so"; 13 | static constexpr std::string_view engine = "engine.so"; 14 | static constexpr std::string_view vgui2 = "vgui2.so"; 15 | static constexpr std::string_view launcher = "launcher.so"; 16 | static constexpr std::string_view libtogl = "libtogl.so"; 17 | static constexpr std::string_view shaderapidx9 = "shaderapidx9.so"; 18 | #else 19 | static constexpr std::string_view client = "client.dll"; 20 | static constexpr std::string_view materialsystem = "materialsystem.dll"; 21 | static constexpr std::string_view engine = "engine.dll"; 22 | static constexpr std::string_view launcher = "launcher.dll"; 23 | static constexpr std::string_view inputsystem = "inputsystem.dll"; 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2017 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /game_cfg/manifest: -------------------------------------------------------------------------------- 1 | old 2 | "241" 2 July 2021 – 20:29:06 UTC 3 | { 4 | download_depot 240 241 3261854995366250836 5 | } 6 | "240" 15 March 2013 – 01:42:44 UTC 7 | { 8 | download_depot 240 240 8533645887610833256 9 | } 10 | "232333" 2 July 2021 – 20:29:06 UTC 11 | { 12 | download_depot 240 232333 8067518758157153958 13 | } 14 | "209" 1 August 2013 – 01:04:17 UTC 15 | { 16 | download_depot 240 209 5452253894472573318 17 | } 18 | 19 | new 20 | "241" 18 February 2025 – 19:42:16 UTC 21 | { 22 | download_depot 240 241 6941588918651947824 23 | } 24 | "240" 15 March 2013 – 01:42:44 UTC 25 | { 26 | download_depot 240 240 8533645887610833256 27 | } 28 | "232333" 18 February 2025 – 19:42:16 UTC 29 | { 30 | download_depot 240 232333 1645363794472800391 31 | } 32 | "209" 18 February 2025 – 19:42:16 UTC 33 | { 34 | download_depot 240 209 7603860182937987947 35 | } 36 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /game_cfg/appmanifest_240.acf: -------------------------------------------------------------------------------- 1 | "AppState" 2 | { 3 | "appid" "240" 4 | "universe" "1" 5 | "name" "Counter-Strike: Source" 6 | "StateFlags" "4" 7 | "installdir" "Counter-Strike Source" 8 | "LastUpdated" "1742167632" 9 | "LastPlayed" "1742171284" 10 | "SizeOnDisk" "4585213376" 11 | "StagingSize" "0" 12 | "buildid" "6946501" 13 | "LastOwner" "76561198217662412" 14 | "AutoUpdateBehavior" "1" 15 | "AllowOtherDownloadsWhileRunning" "0" 16 | "ScheduledAutoUpdate" "1742171287" 17 | "InstalledDepots" 18 | { 19 | "241" 20 | { 21 | "manifest" "3261854995366250836" 22 | "size" "4500132524" 23 | } 24 | "240" 25 | { 26 | "manifest" "8533645887610833256" 27 | "size" "825745" 28 | } 29 | "232333" 30 | { 31 | "manifest" "8067518758157153958" 32 | "size" "84255107" 33 | } 34 | "209" 35 | { 36 | "manifest" "5452253894472573318" 37 | "size" "47205" 38 | } 39 | } 40 | "UserConfig" 41 | { 42 | "language" "english" 43 | "BetaKey" "previous_build" 44 | } 45 | "MountedConfig" 46 | { 47 | "language" "english" 48 | "BetaKey" "previous_build" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Visuals/DrawHook.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 29.06.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../Utility.hpp" 11 | #include "../CallDetour.hpp" 12 | 13 | struct GameVars; 14 | struct SDL_Window; 15 | 16 | class DrawHookSubscriber { 17 | public: 18 | virtual auto onDraw(SDL_Window *window) -> void = 0; 19 | 20 | virtual ~DrawHookSubscriber() = default; 21 | }; 22 | 23 | class DrawHook : public Util::NonCopyable, public Util::NonMovable { 24 | public: 25 | DrawHook(const GameVars&); 26 | ~DrawHook(); 27 | 28 | auto attachSubscriber(DrawHookSubscriber *sub) -> void; 29 | auto detachSubscriber(DrawHookSubscriber *sub) -> void; 30 | 31 | private: 32 | std::mutex m_subscribersMutex; 33 | std::vector m_subscribers; 34 | std::optional _op_sdl_swapWindow_detour; 35 | 36 | auto callSubscribers(SDL_Window *window) -> void; 37 | 38 | static auto hook_SDL_GL_SwapWindow(SDL_Window *window) -> void; 39 | }; 40 | 41 | // FIXME: race condition on use when drawhook is being destroyed 42 | extern DrawHook *g_DrawHook; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-emscripten.md: -------------------------------------------------------------------------------- 1 | Emscripten 2 | ================================================================================ 3 | 4 | Build: 5 | 6 | $ mkdir build 7 | $ cd build 8 | $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2" 9 | $ emmake make 10 | 11 | Or with cmake: 12 | 13 | $ mkdir build 14 | $ cd build 15 | $ emcmake cmake .. 16 | $ emmake make 17 | 18 | To build one of the tests: 19 | 20 | $ cd test/ 21 | $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html 22 | 23 | Uses GLES2 renderer or software 24 | 25 | Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): 26 | 27 | SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): 28 | 29 | $ EMCONFIGURE_JS=1 emconfigure ../configure 30 | build as usual... 31 | 32 | SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx): 33 | 34 | $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx 35 | build as usual... 36 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-cmake.md: -------------------------------------------------------------------------------- 1 | CMake 2 | ================================================================================ 3 | (www.cmake.org) 4 | 5 | SDL's build system was traditionally based on autotools. Over time, this 6 | approach has suffered from several issues across the different supported 7 | platforms. 8 | To solve these problems, a new build system based on CMake is under development. 9 | It works in parallel to the legacy system, so users can experiment with it 10 | without complication. 11 | While still experimental, the build system should be usable on the following 12 | platforms: 13 | 14 | * FreeBSD 15 | * Linux 16 | * VS.NET 2010 17 | * MinGW and Msys 18 | * OS X with support for XCode 19 | 20 | 21 | ================================================================================ 22 | Usage 23 | ================================================================================ 24 | 25 | Assuming the source for SDL is located at ~/sdl 26 | 27 | cd ~ 28 | mkdir build 29 | cd build 30 | cmake ../sdl 31 | 32 | This will build the static and dynamic versions of SDL in the ~/build directory. 33 | -------------------------------------------------------------------------------- /src/Pointers/GameVars.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace overlay_structs { 10 | class LocalPlayer; 11 | class RadarStruct; 12 | } 13 | 14 | class GameVars { 15 | private: 16 | GameVars(); 17 | 18 | public: 19 | using code_region_t = std::span; 20 | 21 | static auto scan() -> GameVars; 22 | 23 | uint32_t& on_ground; 24 | // TODO: explain values - 4, 5, other.. enum? 25 | uint32_t& do_jump; 26 | uint32_t& do_attack_1; 27 | glm::vec3& player_pos; 28 | glm::vec3& angles; 29 | glm::vec3& angles_visual; 30 | uint8_t& is_ingame; 31 | uint32_t& is_inmenu; 32 | auto localplayer() -> std::optional; 33 | auto localplayer() const -> std::optional; 34 | overlay_structs::RadarStruct& radar_struct; 35 | uintptr_t op_sdl_swapWindow_caller; 36 | uintptr_t op_sdl_pollEvent_caller; 37 | 38 | float& fov_vertical_degrees; 39 | std::pair& screen_dimensions; 40 | 41 | private: 42 | uintptr_t localplayer_base; 43 | }; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /src/MemoryScanner/BoyerMooreSegmentScanner.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 24/01/2020. 3 | // 4 | #pragma once 5 | 6 | #include "Utility.hpp" 7 | #include "BoyerMooreDontCare/BoyerMooreDontCare.hpp" 8 | #include "Pointers/Signatures.hpp" 9 | 10 | class BoyerMooreSegmentScanner final { 11 | public: 12 | explicit BoyerMooreSegmentScanner(const SignatureAOI &signatureAOI) 13 | : _signatureAOI(signatureAOI) 14 | , _searcher(_signatureAOI.signature) 15 | { 16 | } 17 | 18 | auto scanSegment(std::string_view haystack, 19 | std::vector &matches) const -> void { 20 | auto &pattern = _signatureAOI.signature.pattern(); 21 | if(haystack.size() < pattern.size()) { 22 | return; 23 | } 24 | std::basic_string_view rawSegmentRange((uint8_t*)haystack.data(), haystack.size()); 25 | auto uint8Matches = _searcher.search(rawSegmentRange); 26 | 27 | std::transform(uint8Matches.begin(), uint8Matches.end(), std::back_inserter(matches), [this](const uint8_t *match) { 28 | auto *signatureAoi = match + _signatureAOI.aoi_offset; 29 | auto signatureAoiAddress = reinterpret_cast(signatureAoi); 30 | 31 | return signatureAoiAddress; 32 | }); 33 | } 34 | 35 | private: 36 | const SignatureAOI &_signatureAOI; 37 | BoyerMooreDontCare _searcher; 38 | }; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "lldb", 6 | "request": "attach", 7 | "name": "Attach", 8 | "pid": "${command:pickMyProcess}" // use ${command:pickProcess} to pick other users' processes 9 | }, 10 | 11 | { 12 | "name": "(Windows) Attach to hl2.exe", 13 | "type": "cppvsdbg", 14 | "request": "attach", 15 | "processName": "hl2.exe", 16 | // "processId":"${command:pickProcess}", 17 | "args": [], 18 | "stopAtEntry": false, 19 | "cwd": "${fileDirname}", 20 | "environment": [], 21 | "console": "externalTerminal" 22 | }, 23 | { 24 | "name": "(Linux) Attach to hl2_linux", 25 | "type": "cppdbg", 26 | "request": "attach", 27 | "program": "/home/theo/.local/share/Steam/steamapps/common/Counter-Strike Source/hl2_linux", 28 | "processName": "hl2_linux", 29 | "processId":"${command:pickProcess}", 30 | "MIMode": "gdb", 31 | "setupCommands": [ 32 | { 33 | "description": "Enable pretty-printing for gdb", 34 | "text": "-enable-pretty-printing", 35 | "ignoreFailures": true 36 | } 37 | ] 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /src/libEntry.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | // flag that tells if the hack was loaded before 7 | extern std::atomic_bool g_loaded; 8 | extern std::mutex g_ejectingFromWithinGameMutex; 9 | extern std::atomic_bool g_ejectingFromWithinGame; 10 | 11 | #ifdef __linux__ 12 | 13 | #include 14 | 15 | extern pthread_t g_nix_hack_thread; 16 | extern pthread_t g_nix_eject_thread; 17 | 18 | auto nix_hack_main(void *) -> void*; 19 | 20 | auto nix_init_hack() -> void; 21 | 22 | __attribute__((constructor)) 23 | auto initLibrary() -> void; 24 | 25 | __attribute__((destructor)) 26 | auto exitLibrary() -> void; 27 | 28 | auto eject_from_within_hack() -> void; 29 | 30 | auto eject_hack(void *) -> void*; 31 | 32 | #else // windows 33 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 34 | #include 35 | 36 | extern HMODULE g_win_hModule; 37 | extern HANDLE g_win_hack_thread; 38 | extern HANDLE g_win_eject_thread; 39 | 40 | auto WINAPI win_hack_main(LPVOID lpParam) -> DWORD; 41 | 42 | // start hack main in its own thread 43 | // source: https://stackoverflow.com/questions/32252143/stdthread-cause-deadlock-in-dllmain 44 | auto win_init_hack() -> void; 45 | 46 | auto WINAPI DllMain(HMODULE hModule, 47 | DWORD ul_reason_for_call, 48 | LPVOID) -> BOOL; 49 | 50 | auto WINAPI win_eject_hack(LPVOID lpParam) -> DWORD; 51 | 52 | auto eject_from_within_hack() -> void; 53 | 54 | auto eject_from_libEntry() -> void; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/MemoryScanner/LinearSegmentScanner.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 24/01/2020. 3 | // 4 | #pragma once 5 | 6 | #include "Utility.hpp" 7 | #include "Pointers/Signatures.hpp" 8 | 9 | class LinearSegmentScanner final { 10 | public: 11 | explicit LinearSegmentScanner(const SignatureAOI &signature) 12 | : _signature(signature) 13 | { 14 | } 15 | 16 | auto scanSegment(std::string_view haystack, 17 | std::vector &matches) const -> void { 18 | auto &pattern = _signature.signature.pattern(); 19 | const char *lastCandidate = &haystack.back() - (pattern.size() - 1); 20 | for(const char &position : haystack) { 21 | if(&position > lastCandidate) { 22 | break; 23 | } 24 | if(signatureMatches(reinterpret_cast(&position))) { 25 | auto *signatureAoi = &position + _signature.aoi_offset; 26 | auto signatureAoiAddress = reinterpret_cast(signatureAoi); 27 | 28 | matches.push_back(signatureAoiAddress); 29 | } 30 | } 31 | } 32 | 33 | private: 34 | const SignatureAOI &_signature; 35 | 36 | auto signatureMatches(const uint8_t *candidate) const -> bool { 37 | auto &mask = _signature.signature.mask(); 38 | auto &pattern = _signature.signature.pattern(); 39 | for(size_t i=0; i 9 | class ForeignPtrBuilderOffset { 10 | public: 11 | ForeignPtrBuilderOffset(BasePtr basePtr, ptrdiff_t offset, OffsetType type) 12 | : m_basePtr(basePtr) 13 | , m_offset(offset) 14 | , m_type(type){} 15 | 16 | ForeignPtrOffset build() const { 17 | return {m_basePtr, m_offset, m_type}; 18 | } 19 | 20 | template 21 | ForeignPtrBuilderOffset, T> add_offset(ptrdiff_t offset, OffsetType type) { 22 | return {m_basePtr, offset, type}; 23 | } 24 | 25 | private: 26 | 27 | BasePtr m_basePtr; 28 | ptrdiff_t m_offset; 29 | OffsetType m_type; 30 | }; 31 | 32 | template 33 | class ForeignPtrBuilderBase { 34 | public: 35 | ForeignPtrBuilderBase(BasePtr basePtr) 36 | : m_basePtr(std::move(basePtr)) {} 37 | 38 | BasePtr build() const { 39 | return m_basePtr; 40 | } 41 | 42 | template 43 | ForeignPtrBuilderOffset add_offset(ptrdiff_t offset, OffsetType type) const { 44 | return {m_basePtr, offset, type}; 45 | } 46 | 47 | private: 48 | BasePtr m_basePtr; 49 | }; 50 | 51 | namespace ForeignPtrBuilder { 52 | ForeignPtrBuilderBase base(uintptr_t rawAddress); 53 | 54 | ForeignPtrBuilderBase base(LibName const &libName); 55 | 56 | template 57 | ForeignPtrBuilderBase base(BasePtr &basePtr); 58 | }; -------------------------------------------------------------------------------- /src/Visuals/GuiElements.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 07.09.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace GuiElements { 11 | struct IntSlider { 12 | int m_rangeBegin; 13 | int m_rangeEnd; 14 | int &m_value; 15 | std::string m_description; 16 | }; 17 | 18 | struct FloatSlider { 19 | float m_rangeBegin; 20 | float m_rangeEnd; 21 | float &m_value; 22 | std::string m_description; 23 | }; 24 | 25 | struct AngleRadSlider { 26 | float m_rangeBeginDegrees; 27 | float m_rangeEndDegrees; 28 | float &m_value; 29 | std::string m_description; 30 | }; 31 | 32 | struct Checkbox { 33 | bool &m_value; 34 | std::string m_description; 35 | }; 36 | 37 | struct Button { 38 | using Callback = std::function; 39 | 40 | Button(std::string description, Callback m_callback) 41 | : m_description(std::move(description)) 42 | , m_callback(std::move(m_callback)) {} 43 | 44 | std::string m_description; 45 | Callback m_callback; 46 | }; 47 | 48 | struct ComboBox { 49 | using Selection = std::vector::const_iterator; 50 | using UpdateHandler = std::function; 51 | 52 | ComboBox(std::vector options, std::string description, UpdateHandler handler) 53 | : m_options(std::move(options)) 54 | , m_currentSelection(m_options.begin()) 55 | , m_description(std::move(description)) 56 | , m_onChangeHandler(std::move(handler)) {} 57 | 58 | std::vector m_options; 59 | Selection m_currentSelection; 60 | std::string m_description; 61 | UpdateHandler m_onChangeHandler; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /src/Pointers/Signatures.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 12.10.19. 3 | // 4 | #pragma once 5 | #include 6 | 7 | #include "BoyerMooreDontCare/Signature.hpp" 8 | 9 | /// Byte pattern used to find a memory location. 10 | /// Signatures are defined by a C-string describing the bytes that make up the wanted piece of memory. 11 | /// Known bytes are specified in hex, variable/"don't care" bytes using '??' 12 | /// 13 | /// example: "74 4E E8 ?? ?? ?? ??" 14 | /// would match every byte array of length 7 with specified first 3 bytes. 15 | struct SignatureAOI { 16 | SignatureAOI(std::string_view libName, Signature signature, ptrdiff_t aoi_offset, size_t aoi_length) 17 | : libName(libName) 18 | , signature(std::move(signature)) 19 | , aoi_offset(aoi_offset) 20 | , aoi_length(aoi_length) {} 21 | 22 | std::string_view libName; 23 | Signature signature; 24 | ptrdiff_t aoi_offset; 25 | size_t aoi_length; 26 | }; 27 | 28 | namespace Signatures { 29 | // bunnyhop 30 | extern SignatureAOI onGround_op_land; 31 | extern SignatureAOI onGround_op_leave; 32 | extern SignatureAOI onGround; 33 | extern SignatureAOI doJump; 34 | 35 | // aimbot 36 | extern SignatureAOI aimAngles_x_op_read; 37 | extern SignatureAOI aimAngles; 38 | extern SignatureAOI aimAnglesVisual_update; 39 | // search for targetID instead 40 | extern SignatureAOI localplayer_base; 41 | extern SignatureAOI playerArray_base; 42 | // search for head pos, so you can duck/stand while scanning 43 | extern SignatureAOI playerPos; 44 | extern SignatureAOI doAttack_op_read; 45 | extern SignatureAOI doAttack; 46 | 47 | // input 48 | extern SignatureAOI sdl_pollEvent_caller; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /src/RAIIHandle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 3 | #include // CloseHandle 4 | 5 | // RAII wrapper for a windows handle, calling CloseHandle(HANDLE) on destruct 6 | class RAIIHandle { 7 | private: 8 | HANDLE m_handle; 9 | 10 | // closes wrapped handle and invalidifies its value 11 | auto reset() -> void { 12 | if (isValid()) { 13 | CloseHandle(m_handle); 14 | m_handle = INVALID_HANDLE_VALUE; 15 | } 16 | } 17 | 18 | public: 19 | explicit RAIIHandle(HANDLE h) : m_handle(h) {} 20 | // no copying, only one RAIIHandle per HANDLE 21 | RAIIHandle(const RAIIHandle& other) = delete; 22 | RAIIHandle(RAIIHandle&& other) noexcept : m_handle(other.getRaw()) { 23 | other.m_handle = INVALID_HANDLE_VALUE; 24 | } 25 | ~RAIIHandle() { 26 | reset(); 27 | } 28 | 29 | // disallow copying from an already wrapped handle 30 | auto operator=(const RAIIHandle& other) -> RAIIHandle& = delete; 31 | // wraps a naked handle, resetting the already wrapped one 32 | auto operator=(const HANDLE& other) -> RAIIHandle& { 33 | reset(); 34 | m_handle = other; 35 | return *this; 36 | } 37 | 38 | // moves another handle into this one 39 | auto operator=(RAIIHandle&& other) -> RAIIHandle& { 40 | m_handle = other.m_handle; 41 | other.m_handle = INVALID_HANDLE_VALUE; 42 | return *this; 43 | } 44 | 45 | auto getRaw() const -> HANDLE { 46 | return m_handle; 47 | } 48 | 49 | auto isValid() const -> bool { 50 | return m_handle != INVALID_HANDLE_VALUE && 51 | m_handle != nullptr; 52 | } 53 | }; 54 | -------------------------------------------------------------------------------- /src/Visuals/Gui_imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /script/eject.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # source: https://aixxe.net/2016/09/shared-library-injection 3 | 4 | # Check if script is run as root (sudo) 5 | if [ "$EUID" -ne 0 ]; then 6 | echo "Ejection failed: Please run as root or use sudo." 7 | exit 1 8 | fi 9 | 10 | # cd into the script's directory 11 | cd "$(dirname "$0")" 12 | 13 | process=hl2_linux 14 | pid=$(pidof $process) 15 | libraryPath=$(realpath "../build/libcssHack.so") 16 | library=$(basename $libraryPath) 17 | 18 | # check running 19 | if [ -z "$pid" ] 20 | then 21 | echo "$process is not running" 22 | exit 1 23 | fi 24 | 25 | echo "Process: $process (pid: $pid)" 26 | echo "Library: $libraryPath" 27 | 28 | # check if library is injected 29 | if ! grep -q $libraryPath /proc/$pid/maps ; 30 | then 31 | echo "Library $library is not loaded. Exiting." 32 | exit 33 | fi 34 | 35 | # eject 36 | echo "Library $library is loaded. Ejecting" 37 | 38 | # enable gdb attach with ptrace (disable ptrace scope) 39 | ./disable_ptrace_scope.bash 40 | 41 | # write gdb script 42 | echo " 43 | attach $pid 44 | set \$dlopen = (void*(*)(char*, int)) dlopen 45 | set \$dlclose = (int(*)(void*)) dlclose 46 | set \$library = \$dlopen(\"$libraryPath\", 6) 47 | call \$dlclose(\$library) 48 | call \$dlclose(\$library) 49 | detach 50 | quit 51 | " > eject.gdb 52 | 53 | # eject 54 | gdb -q --batch --command=eject.gdb 55 | 56 | # remove gdb script 57 | rm eject.gdb 58 | 59 | # check running 60 | pid=$(pidof $process) 61 | if [ -z "$pid" ] 62 | then 63 | echo "Ejection failed: $process crashed" 64 | exit 1 65 | fi 66 | 67 | # check success 68 | if ! grep -q $libraryPath /proc/$pid/maps ; then 69 | echo "Ejected library $library from process $process (pid: $pid)" 70 | else 71 | echo "Ejection failed: Library $library still in process $process (pid: $pid)" 72 | fi -------------------------------------------------------------------------------- /script/inject.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # source: https://aixxe.net/2016/09/shared-library-injection 3 | 4 | # Check if script is run as root (sudo) 5 | if [ "$EUID" -ne 0 ]; then 6 | echo "Injection failed: Please run as root or use sudo." 7 | exit 1 8 | fi 9 | 10 | # cd into the script's directory 11 | cd "$(dirname "$0")" 12 | 13 | process=hl2_linux 14 | pid=$(pidof $process) 15 | libraryPath=$(realpath "../build/libcssHack.so") 16 | library=$(basename $libraryPath) 17 | 18 | # check running 19 | if [ -z "$pid" ] 20 | then 21 | echo "$process is not running" 22 | exit 1 23 | fi 24 | 25 | echo "Process: $process (pid: $pid)" 26 | echo "Library: $libraryPath" 27 | 28 | # check already injected 29 | if grep -q $libraryPath /proc/$pid/maps ; 30 | then 31 | echo "Library $library already loaded. Exiting." 32 | exit 33 | fi 34 | 35 | # inject 36 | echo "Injecting library $library." 37 | 38 | # enable gdb attach with ptrace (disable ptrace scope) 39 | ./disable_ptrace_scope.bash 40 | 41 | # write gdb script 42 | echo " 43 | attach $pid 44 | set \$dlopen = (void*(*)(char*, int)) dlopen 45 | set \$result = \$dlopen(\"$libraryPath\", 1) 46 | if \$result == 0 47 | printf \"Injection Error: %s\\n\", (char*)dlerror() 48 | else 49 | print \"Injection Success\" 50 | end 51 | detach 52 | quit 53 | " > inject.gdb 54 | 55 | # inject 56 | gdb -q --batch --command=inject.gdb 57 | 58 | # remove gdb script 59 | rm inject.gdb 60 | 61 | # check running 62 | pid=$(pidof $process) 63 | if [ -z "$pid" ] 64 | then 65 | echo "Injection failed: $process crashed" 66 | exit 1 67 | fi 68 | 69 | # check success 70 | if grep -q $libraryPath /proc/$pid/maps; then 71 | echo "Injected library $library into process $process (pid: $pid)" 72 | else 73 | echo "Injection failed: Library $library not found in process $process (pid: $pid)" 74 | fi 75 | -------------------------------------------------------------------------------- /src/Pointers/overlay_structs.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "Offsets.hpp" 8 | 9 | namespace overlay_structs { 10 | struct Player { 11 | enum class TEAM : int { 12 | SPECT = 1, 13 | T = 2, 14 | CT = 3 15 | }; 16 | 17 | uint32_t m_arrayIndex; 18 | uint32_t m_valid; // if this is >0, then the described player is currently on the server 19 | char m_unknown[8]; 20 | 21 | char m_name[32]; // most likely encoded with "CodePage" - no idea what that is 22 | 23 | TEAM m_team; 24 | int m_health; 25 | glm::vec3 m_pos; 26 | glm::vec3 m_viewangles; 27 | int64_t m_footstep_history[30]; // 30x8 bytes - getting updated one after another after movement 28 | 29 | auto is_valid() const -> bool { 30 | return m_valid > 0; 31 | } 32 | 33 | auto isActive() const -> bool { 34 | return is_valid() && 35 | m_team != Player::TEAM::SPECT && 36 | m_health > 0; 37 | } 38 | }; 39 | 40 | struct LocalPlayer { 41 | union { 42 | struct { 43 | uint8_t padding[Offsets::localplayer_off_team]; 44 | Player::TEAM value; 45 | } team; 46 | 47 | struct { 48 | uint8_t padding[Offsets::localplayer_off_punch]; 49 | glm::vec3 value; 50 | } punch_angles; 51 | 52 | struct { 53 | uint8_t padding[Offsets::localplayer_off_targetId]; 54 | uint32_t value; 55 | } target_id; 56 | }; 57 | }; 58 | 59 | struct RadarStruct { 60 | uint8_t padding[Offsets::radarstruct_playerArray_off]; 61 | std::array players; 62 | }; 63 | } -------------------------------------------------------------------------------- /src/Pointers/Offsets.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 16.06.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | 8 | enum class OffsetType { 9 | DEREFERENCE, 10 | PLAIN_OFFSET 11 | }; 12 | 13 | namespace Offsets { 14 | // Aimbot 15 | #ifdef __linux__ 16 | constexpr ptrdiff_t client_viewAngleVis = 0xBC3E14; 17 | 18 | constexpr ptrdiff_t localplayer_off_team = 0x8C; 19 | constexpr ptrdiff_t localplayer_off_punch = 0xE28; 20 | constexpr ptrdiff_t localplayer_off_targetId = 0x14D0; 21 | constexpr ptrdiff_t playerArray_off = 0x28; 22 | constexpr ptrdiff_t client_radarstruct_playerArray_base = 0xBE9380; 23 | constexpr ptrdiff_t radarstruct_playerArray_off = 0x28; 24 | 25 | #else 26 | constexpr ptrdiff_t client_viewAngleVis = 0x504644; 27 | constexpr ptrdiff_t localplayer_off_team = 0x9c; 28 | constexpr ptrdiff_t localplayer_off_punch= 0xE48; 29 | constexpr ptrdiff_t localplayer_off_targetId = 0x14f0; 30 | constexpr ptrdiff_t playerArray_off = 0x28; 31 | #endif 32 | 33 | // Hack 34 | #ifdef __linux__ 35 | constexpr ptrdiff_t materialsystem_isIngame = 0x15B869; 36 | constexpr ptrdiff_t vgui2_isInMenu = 0x68720; 37 | #else 38 | constexpr ptrdiff_t materialsystem_isIngame = 0x1215C9; 39 | #endif 40 | // Input 41 | #ifdef __linux__ 42 | constexpr ptrdiff_t launcher_sdl_pollEvent_caller = 0x3325B; 43 | #else 44 | constexpr ptrdiff_t inputsystem_sdl_pollEvent_caller = 0x3A22; 45 | #endif 46 | // ESP 47 | #ifdef __linux__ 48 | constexpr ptrdiff_t launcher_sdl_swapWindow_caller = 0x311BC; 49 | constexpr ptrdiff_t engine_screenDimensions = 0xD20014; 50 | constexpr ptrdiff_t engine_fov_vertical_degrees = 0xC720A4; // TIP: game cvar "fov" doesn't show real FOV. With fov=90, the real fov_y is ~73° 51 | #else 52 | #endif 53 | // Wallhack 54 | #ifdef __linux__ 55 | constexpr ptrdiff_t shaderapidx9_drawIndexedPrimitive_caller = 0x2DABC; 56 | #else 57 | #endif 58 | } 59 | -------------------------------------------------------------------------------- /src/CallDetour.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 23.08.20. 3 | // 4 | #pragma once 5 | 6 | #include "MemoryUtils.hpp" 7 | #include "Utility.hpp" 8 | 9 | /// \brief Redirects a call assembly operation. 10 | /// Actions are reverted upon destruction. 11 | class CallDetour final : public Util::NonCopyable { 12 | public: 13 | /// \param addr_call_opcode Address of call operation byte 14 | /// \param addr_new_target Address of replacement function 15 | CallDetour(Util::Address addr_call_opcode, Util::Address addr_new_target) 16 | : _addr_call_opcode{ addr_call_opcode } 17 | , _old_call_target_offset{ _redirect_call(addr_call_opcode, addr_new_target) } { 18 | } 19 | 20 | ~CallDetour() { 21 | _restore_opcodes(); 22 | } 23 | 24 | private: 25 | Util::Address _addr_call_opcode; 26 | Util::Offset _old_call_target_offset; 27 | 28 | auto _redirect_call(Util::Address addr_call_opcode, Util::Address addr_new_target) const -> Util::Offset { 29 | // calculate call-relative address to target 30 | Util::Address addr_next_op = addr_call_opcode + Util::Offset{ 0x05 }; 31 | Util::Offset offset_next_op_to_target = addr_new_target - addr_next_op; 32 | Util::Address addr_call_target_offset = addr_call_opcode + Util::Offset{ 0x01 }; 33 | 34 | auto old_call_target_offset = *addr_call_target_offset.as_pointer(); 35 | 36 | // patch this shit 37 | auto scoped_permission = MemoryUtils::scoped_remove_memory_protection(addr_call_target_offset, 4); 38 | *addr_call_target_offset.as_pointer() = offset_next_op_to_target; 39 | 40 | return old_call_target_offset; 41 | } 42 | 43 | auto _restore_opcodes() const -> void { 44 | Util::Address addr_call_target_offset = _addr_call_opcode + Util::Offset{ 0x01 }; 45 | 46 | auto scoped_permission = MemoryUtils::scoped_remove_memory_protection(addr_call_target_offset, 4); 47 | *addr_call_target_offset.as_pointer() = _old_call_target_offset; 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /src/Visuals/DrawHook.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 29.06.19. 3 | // 4 | 5 | #include // std::remove 6 | 7 | #include // SDL_Window, SDL_GL_SwapWindow 8 | //#include 9 | #include 10 | 11 | #include "DrawHook.hpp" 12 | #include "../MemoryUtils.hpp" 13 | #include "../Pointers/libNames.hpp" 14 | #include "../Pointers/GameVars.hpp" 15 | #include "../Pointers/Offsets.hpp" 16 | 17 | DrawHook *g_DrawHook = nullptr; 18 | 19 | DrawHook::DrawHook(const GameVars &gameVars) 20 | : m_subscribersMutex() 21 | , m_subscribers() 22 | , _op_sdl_swapWindow_detour{} { 23 | g_DrawHook = this; 24 | _op_sdl_swapWindow_detour.emplace(Util::Address(gameVars.op_sdl_swapWindow_caller), 25 | Util::Address((uintptr_t)(hook_SDL_GL_SwapWindow))); 26 | } 27 | 28 | DrawHook::~DrawHook() { 29 | // TODO: Wireframe mode! 30 | // glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 31 | } 32 | 33 | auto DrawHook::attachSubscriber(DrawHookSubscriber *sub) -> void { 34 | std::scoped_lock l_lock(m_subscribersMutex); 35 | m_subscribers.push_back(sub); 36 | } 37 | 38 | auto DrawHook::detachSubscriber(DrawHookSubscriber *sub) -> void { 39 | std::scoped_lock l_lock(m_subscribersMutex); 40 | m_subscribers.erase(std::remove(m_subscribers.begin(), 41 | m_subscribers.end(), 42 | sub), 43 | m_subscribers.end()); 44 | } 45 | 46 | auto DrawHook::callSubscribers(SDL_Window *window) -> void { 47 | std::scoped_lock l_lock(m_subscribersMutex); 48 | for (auto &subscriber : m_subscribers) { 49 | subscriber->onDraw(window); 50 | } 51 | } 52 | 53 | auto DrawHook::hook_SDL_GL_SwapWindow(SDL_Window *window) -> void { 54 | g_DrawHook->callSubscribers(window); 55 | 56 | SDL_GL_SwapWindow(window); 57 | 58 | // TODO: Wireframe mode! 59 | // glClearColor(0, 0, 0, 1); 60 | // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 61 | // 62 | // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 63 | } 64 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /src/MemoryUtils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 05.10.19. 3 | // 4 | #include "MemoryUtils.hpp" 5 | #define DEFAULT_LOG_CHANNEL Log::Channel::MESSAGE_BOX 6 | 7 | #include "Log.hpp" 8 | 9 | auto MemoryUtils::MemoryRange::address() const -> uintptr_t { 10 | return reinterpret_cast(memoryRange.data()); 11 | } 12 | 13 | using ScopedReProtect = MemoryUtils::ScopedReProtect; 14 | 15 | ScopedReProtect::ScopedReProtect(MemoryRange oldProtection) 16 | : _active(true) 17 | , _oldProtection(oldProtection) {} 18 | 19 | ScopedReProtect::ScopedReProtect(ScopedReProtect &&other) noexcept 20 | : _active(other._active) 21 | , _oldProtection(other._oldProtection) { 22 | other._active = false; 23 | } 24 | 25 | auto ScopedReProtect::operator=(ScopedReProtect &&other) noexcept -> ScopedReProtect& { 26 | _active = other._active; 27 | other._active = false; 28 | _oldProtection = other._oldProtection; 29 | return *this; 30 | } 31 | 32 | ScopedReProtect::~ScopedReProtect() { 33 | restore(); 34 | } 35 | 36 | auto ScopedReProtect::restore() -> bool { 37 | if (_active) { 38 | auto result = set_memory_protection(_oldProtection); 39 | if (result.has_value()) { 40 | _active = false; 41 | } 42 | } 43 | 44 | return !_active; 45 | } 46 | 47 | auto MemoryUtils::lib_base_32(std::string_view libName) -> uintptr_t { 48 | auto l_libBase = lib_base_32_timeout(libName, (std::chrono::milliseconds::max) ()); 49 | if (!l_libBase) { 50 | std::string error{libName}; 51 | error += " base addr not found"; 52 | Log::log(error); 53 | throw std::runtime_error(error); 54 | } 55 | return *l_libBase; 56 | } 57 | 58 | auto MemoryUtils::scoped_remove_memory_protection(uintptr_t address, size_t length) -> std::optional { 59 | auto *charAddress = reinterpret_cast(address); 60 | MemoryRange newProtection{ { charAddress, length}, MemoryRange::noProtection() }; 61 | auto formerProtection = set_memory_protection(newProtection); 62 | 63 | if (formerProtection.has_value()) { 64 | return ScopedReProtect(*formerProtection); 65 | } else { 66 | return std::nullopt; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "atomic": "cpp", 4 | "array": "cpp", 5 | "strstream": "cpp", 6 | "bit": "cpp", 7 | "*.tcc": "cpp", 8 | "bitset": "cpp", 9 | "cctype": "cpp", 10 | "charconv": "cpp", 11 | "chrono": "cpp", 12 | "clocale": "cpp", 13 | "cmath": "cpp", 14 | "compare": "cpp", 15 | "concepts": "cpp", 16 | "condition_variable": "cpp", 17 | "cstdarg": "cpp", 18 | "cstddef": "cpp", 19 | "cstdint": "cpp", 20 | "cstdio": "cpp", 21 | "cstdlib": "cpp", 22 | "cstring": "cpp", 23 | "ctime": "cpp", 24 | "cwchar": "cpp", 25 | "cwctype": "cpp", 26 | "deque": "cpp", 27 | "list": "cpp", 28 | "map": "cpp", 29 | "set": "cpp", 30 | "string": "cpp", 31 | "unordered_map": "cpp", 32 | "vector": "cpp", 33 | "exception": "cpp", 34 | "algorithm": "cpp", 35 | "functional": "cpp", 36 | "iterator": "cpp", 37 | "memory": "cpp", 38 | "memory_resource": "cpp", 39 | "numeric": "cpp", 40 | "optional": "cpp", 41 | "random": "cpp", 42 | "ratio": "cpp", 43 | "regex": "cpp", 44 | "string_view": "cpp", 45 | "system_error": "cpp", 46 | "tuple": "cpp", 47 | "type_traits": "cpp", 48 | "utility": "cpp", 49 | "format": "cpp", 50 | "fstream": "cpp", 51 | "initializer_list": "cpp", 52 | "iomanip": "cpp", 53 | "iosfwd": "cpp", 54 | "iostream": "cpp", 55 | "istream": "cpp", 56 | "limits": "cpp", 57 | "mutex": "cpp", 58 | "new": "cpp", 59 | "numbers": "cpp", 60 | "ostream": "cpp", 61 | "semaphore": "cpp", 62 | "span": "cpp", 63 | "sstream": "cpp", 64 | "stdexcept": "cpp", 65 | "stop_token": "cpp", 66 | "streambuf": "cpp", 67 | "thread": "cpp", 68 | "cinttypes": "cpp", 69 | "typeinfo": "cpp", 70 | "variant": "cpp", 71 | "text_encoding": "cpp", 72 | "source_location": "cpp" 73 | } 74 | } -------------------------------------------------------------------------------- /src/Visuals/GUI.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 01.08.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include "../Utility.hpp" 10 | #include "DrawHook.hpp" 11 | #include "../Input.hpp" 12 | #include "GuiElements.hpp" 13 | 14 | struct SDL_KeyboardEvent; 15 | union SDL_Event; 16 | struct SDL_Window; 17 | 18 | class GUI : protected DrawHookSubscriber, public Util::NonCopyable, public Util::NonMovable { 19 | public: 20 | GUI(DrawHook &drawHook, Input &keyboard); 21 | 22 | ~GUI() override; 23 | 24 | auto registerFloatSlider(GuiElements::FloatSlider slider) -> void; 25 | 26 | auto registerCheckbox(GuiElements::Checkbox checkBox) -> void; 27 | 28 | auto registerIntSlider(GuiElements::IntSlider slider) -> void; 29 | 30 | auto registerAngleRadSlider(GuiElements::AngleRadSlider slider) -> void; 31 | 32 | auto registerComboBox(GuiElements::ComboBox comboBox) -> void; 33 | 34 | auto registerButton(GuiElements::Button button) -> void; 35 | 36 | protected: 37 | 38 | auto onDraw(SDL_Window *window) -> void override; 39 | 40 | private: 41 | DrawHook &m_drawHook; 42 | Input &m_input; 43 | ScopedKeyHandler m_guiKeyHandler; 44 | std::mutex m_debugFloatSlidersMutex; 45 | std::vector m_debugFloatSliders; 46 | 47 | std::mutex m_debugCheckboxesMutex; 48 | std::vector m_debugCheckboxes; 49 | std::mutex m_debugIntSlidersMutex; 50 | std::vector m_debugIntSliders; 51 | 52 | std::mutex m_debugAngleSlidersMutex; 53 | std::vector m_debugAngleSliders; 54 | 55 | std::mutex m_debugComboBoxesMutex; 56 | std::vector m_debugComboBoxes; 57 | 58 | std::mutex m_debugButtonsMutex; 59 | std::vector m_debugButtons; 60 | 61 | struct ImGuiConnection { 62 | 63 | }; 64 | 65 | // imgui stuff 66 | std::mutex m_initImGuiMutex; 67 | bool m_didInitImGui; 68 | std::mutex m_showGuiMutex; 69 | bool m_showGui; 70 | 71 | auto onGuiKey(SDL_KeyboardEvent const &event) -> bool; 72 | 73 | auto initImGui(SDL_Window *window) -> void; 74 | 75 | auto shutdownImGui() -> void; 76 | 77 | auto imGuiNewFrame(SDL_Window *window) -> void; 78 | 79 | }; 80 | -------------------------------------------------------------------------------- /src/unused/pointers/ForeignPointer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 29.06.19. 3 | // 4 | #pragma once 5 | 6 | #include // uintptr_t 7 | #include // ptrdiff_t 8 | #include 9 | #include 10 | #include 11 | 12 | #include "../../MemoryUtils.hpp" 13 | 14 | #define DEFAULT_LOG_CHANNEL Log::Channel::MESSAGE_BOX 15 | 16 | #include "../../Log.hpp" 17 | #include "../../Pointers/libNames.hpp" 18 | 19 | template 20 | class ForeignPointerBase { 21 | private: 22 | uintptr_t m_value; 23 | 24 | void update() { 25 | std::optional l_module_base; 26 | l_module_base = MemoryUtils::get_lib_base_32(module); 27 | if (!l_module_base.has_value()) { 28 | Log::log(module, " base addr not found"); 29 | throw std::runtime_error(module.name() + " base addr not found"); 30 | } 31 | m_value = l_module_base.value(); 32 | } 33 | 34 | uintptr_t value() const { 35 | return m_value; 36 | } 37 | 38 | public: 39 | ForeignPointerBase() 40 | : m_value() { 41 | update(); 42 | } 43 | }; 44 | 45 | template 46 | class ForeignPointerBase { 47 | uintptr_t value() const { 48 | return T.value(); 49 | } 50 | }; 51 | 52 | template 53 | class ForeignPointer { 54 | static_assert(std::is_same_v || 55 | std::is_same_v); 56 | private: 57 | T *m_value; 58 | public: 59 | ForeignPointer() 60 | : m_value(nullptr) { 61 | update(); 62 | } 63 | 64 | void update() { 65 | uintptr_t l_basePtr; 66 | if constexpr (std::is_same_v) { 67 | } else if constexpr (std::is_same_v) { 68 | Base base; 69 | l_basePtr = static_cast(base.value()); 70 | } 71 | T *pointer = static_cast; 72 | 73 | std::initializer_list l_offsets; 74 | for (ptrdiff_t offset : l_offsets) { 75 | pointer = *static_cast(base + offset); 76 | } 77 | 78 | } 79 | 80 | T *value() const { 81 | return m_value; 82 | } 83 | 84 | T &operator*() const { 85 | return *m_value; 86 | } 87 | 88 | T *operator->() const { 89 | return m_value; 90 | } 91 | }; -------------------------------------------------------------------------------- /script/build_SDL.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd into the script's directory 4 | cd "$(dirname "$0")" 5 | 6 | SDL_DIR=$(realpath "../lib/SDL") 7 | BUILD_DIR="../build/lib/SDL" 8 | mkdir -p $BUILD_DIR 9 | BUILD_DIR=$(realpath "../build/lib/SDL") 10 | INSTALL_DIR="$BUILD_DIR/install" 11 | 12 | cd $BUILD_DIR 13 | 14 | # command from libsdl2-dev:i386 source package build log 15 | # libsdl2-dev 2.30.0+dfsg-1build3 (i386 binary) in ubuntu noble 16 | # https://launchpad.net/ubuntu/+source/libsdl2/2.30.0+dfsg-1build3/+build/28030357/+files/buildlog_ubuntu-noble-i386.libsdl2_2.30.0+dfsg-1build3_BUILDING.txt.gz 17 | # also: 32 bit addition with CFLAGS CXXFLAGS and LDFLAGS from https://discourse.libsdl.org/t/building-sdl2-for-32-bit-on-a-64-bit-linux/24331/4 18 | $SDL_DIR/configure --build=i686-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --prefix=$(realpath $INSTALL_DIR) --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=\${prefix}/lib/i386-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --disable-alsa-shared --disable-arts --disable-directx --disable-esd --disable-fusionsound --disable-jack --disable-joystick-mfi --disable-kmsdrm-shared --disable-libsamplerate-shared --disable-nas --disable-pulseaudio-shared --disable-render-d3d --disable-rpath --disable-video-cocoa --disable-video-directfb --disable-video-metal --disable-video-opengles1 --disable-video-rpi --disable-video-vivante --disable-wasapi --disable-wayland-shared --disable-x11-shared --disable-xinput --enable-alsa --enable-dbus --enable-fcitx --enable-hidapi --enable-hidapi-joystick --enable-ibus --enable-libsamplerate --enable-pulseaudio --enable-sdl2-config --enable-sndio "--enable-vendor-info=Ubuntu 2.30.0+dfsg-1build3" --enable-video-kmsdrm --enable-video-opengl --enable-video-opengles --enable-video-opengles2 --enable-video-x11 --enable-libdecor --enable-libudev --enable-pipewire --enable-video-vulkan --enable-video-wayland ac_cv_header_libunwind_h=no 19 | 20 | # build 21 | BUILD_THREADS=$(($(nproc) + 2)) 22 | make -j $BUILD_THREADS 23 | 24 | # install 25 | # source: https://wiki.libsdl.org/SDL2/Installation 26 | make install -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-porting.md: -------------------------------------------------------------------------------- 1 | Porting 2 | ======= 3 | 4 | * Porting To A New Platform 5 | 6 | The first thing you have to do when porting to a new platform, is look at 7 | include/SDL_platform.h and create an entry there for your operating system. 8 | The standard format is "__PLATFORM__", where PLATFORM is the name of the OS. 9 | Ideally SDL_platform.h will be able to auto-detect the system it's building 10 | on based on C preprocessor symbols. 11 | 12 | There are two basic ways of building SDL at the moment: 13 | 14 | 1. The "UNIX" way: ./configure; make; make install 15 | 16 | If you have a GNUish system, then you might try this. Edit configure.ac, 17 | take a look at the large section labelled: 18 | 19 | "Set up the configuration based on the host platform!" 20 | 21 | Add a section for your platform, and then re-run autogen.sh and build! 22 | 23 | 2. Using an IDE: 24 | 25 | If you're using an IDE or other non-configure build system, you'll probably 26 | want to create a custom SDL_config.h for your platform. Edit SDL_config.h, 27 | add a section for your platform, and create a custom SDL_config_{platform}.h, 28 | based on SDL_config_minimal.h and SDL_config.h.in 29 | 30 | Add the top level include directory to the header search path, and then add 31 | the following sources to the project: 32 | 33 | src/*.c 34 | src/atomic/*.c 35 | src/audio/*.c 36 | src/cpuinfo/*.c 37 | src/events/*.c 38 | src/file/*.c 39 | src/haptic/*.c 40 | src/joystick/*.c 41 | src/power/*.c 42 | src/render/*.c 43 | src/render/software/*.c 44 | src/stdlib/*.c 45 | src/thread/*.c 46 | src/timer/*.c 47 | src/video/*.c 48 | src/audio/disk/*.c 49 | src/audio/dummy/*.c 50 | src/filesystem/dummy/*.c 51 | src/video/dummy/*.c 52 | src/haptic/dummy/*.c 53 | src/joystick/dummy/*.c 54 | src/main/dummy/*.c 55 | src/thread/generic/*.c 56 | src/timer/dummy/*.c 57 | src/loadso/dummy/*.c 58 | 59 | 60 | Once you have a working library without any drivers, you can go back to each 61 | of the major subsystems and start implementing drivers for your platform. 62 | 63 | If you have any questions, don't hesitate to ask on the SDL mailing list: 64 | http://www.libsdl.org/mailing-list.php 65 | 66 | Enjoy! 67 | Sam Lantinga (slouken@libsdl.org) 68 | 69 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * \brief Put UTF-8 text into the clipboard 43 | * 44 | * \sa SDL_GetClipboardText() 45 | */ 46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 47 | 48 | /** 49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() 50 | * 51 | * \sa SDL_SetClipboardText() 52 | */ 53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 54 | 55 | /** 56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty 57 | * 58 | * \sa SDL_GetClipboardText() 59 | */ 60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 61 | 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* SDL_clipboard_h_ */ 70 | 71 | /* vi: set ts=4 sw=4 expandtab: */ 72 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /src/Bunnyhop.cpp: -------------------------------------------------------------------------------- 1 | #include "Bunnyhop.hpp" 2 | #include "Pointers/Signatures.hpp" 3 | #include "Pointers/overlay_structs.hpp" 4 | 5 | #define DEFAULT_LOG_CHANNEL Log::Channel::MESSAGE_BOX 6 | #include "Log.hpp" 7 | 8 | Bunnyhop::Bunnyhop(GameVars gameVars) 9 | : gameVars(gameVars) 10 | , m_detour_onGround_inc() 11 | , m_detour_onGround_dec() 12 | , m_enabled(false) { 13 | hook(); 14 | } 15 | 16 | Bunnyhop::~Bunnyhop() { 17 | stop(); 18 | unhook(); 19 | } 20 | 21 | auto Bunnyhop::isEnabled() const -> bool { 22 | return m_enabled; 23 | } 24 | 25 | auto Bunnyhop::start() -> void { 26 | if (!m_enabled) { 27 | // the fake jumps are only triggered by landing on the ground, not while being on ground 28 | // so if we're currently standing on the ground... 29 | if (gameVars.on_ground != 0) { 30 | // we're manually faking the first jump 31 | gameVars.do_jump = 5; 32 | } 33 | 34 | m_enabled = true; 35 | } 36 | } 37 | 38 | auto Bunnyhop::stop() -> void { 39 | if (m_enabled) { 40 | m_enabled = false; 41 | 42 | // prevent bhop not starting 43 | // when jump key is down when you land on the ground and bhop is enabled 44 | gameVars.do_jump = 4; 45 | } 46 | } 47 | 48 | auto Bunnyhop::hook() -> void { 49 | bool l_inc_detour_success = m_detour_onGround_inc.install( 50 | Signatures::onGround_op_land, 51 | [this] { hook_onGround_inc(); }, 52 | DetourToCallback::CODE_BEFORE_DETOUR); 53 | 54 | if (!l_inc_detour_success) { 55 | Log::log("Bunnyhop failed to detour inc on_ground"); 56 | } 57 | 58 | bool l_dec_detour_success = m_detour_onGround_dec.install( 59 | Signatures::onGround_op_leave, 60 | [this] { hook_onGround_dec(); }, 61 | DetourToCallback::CODE_BEFORE_DETOUR); 62 | 63 | if (!l_dec_detour_success) { 64 | Log::log("Bunnyhop failed to detour dec on_ground"); 65 | } 66 | } 67 | 68 | auto Bunnyhop::unhook() -> void { 69 | if (!m_detour_onGround_inc.remove()) { 70 | Log::log("Bunnyhop failed to un-detour inc on_ground"); 71 | } 72 | 73 | if (!m_detour_onGround_dec.remove()) { 74 | Log::log("Bunnyhop failed to un-detour dec on_ground"); 75 | } 76 | } 77 | 78 | auto Bunnyhop::hook_onGround_inc() -> void { 79 | if (m_enabled) { 80 | gameVars.do_jump = 5; 81 | } 82 | } 83 | 84 | auto Bunnyhop::hook_onGround_dec() -> void { 85 | if (m_enabled) { 86 | gameVars.do_jump = 4; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README.md: -------------------------------------------------------------------------------- 1 | Simple DirectMedia Layer {#mainpage} 2 | ======================== 3 | 4 | (SDL) 5 | 6 | Version 2.0 7 | 8 | --- 9 | http://www.libsdl.org/ 10 | 11 | Simple DirectMedia Layer is a cross-platform development library designed 12 | to provide low level access to audio, keyboard, mouse, joystick, and graphics 13 | hardware via OpenGL and Direct3D. It is used by video playback software, 14 | emulators, and popular games including Valve's award winning catalog 15 | and many Humble Bundle games. 16 | 17 | SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. 18 | Support for other platforms may be found in the source code. 19 | 20 | SDL is written in C, works natively with C++, and there are bindings 21 | available for several other languages, including C# and Python. 22 | 23 | This library is distributed under the zlib license, which can be found 24 | in the file "COPYING.txt". 25 | 26 | The best way to learn how to use SDL is to check out the header files in 27 | the "include" subdirectory and the programs in the "test" subdirectory. 28 | The header files and test programs are well commented and always up to date. 29 | 30 | More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) 31 | 32 | - [Android](README-android.md) 33 | - [CMake](README-cmake.md) 34 | - [DirectFB](README-directfb.md) 35 | - [DynAPI](README-dynapi.md) 36 | - [Emscripten](README-emscripten.md) 37 | - [Gesture](README-gesture.md) 38 | - [Mercurial](README-hg.md) 39 | - [iOS](README-ios.md) 40 | - [Linux](README-linux.md) 41 | - [OS X](README-macosx.md) 42 | - [Native Client](README-nacl.md) 43 | - [Pandora](README-pandora.md) 44 | - [Supported Platforms](README-platforms.md) 45 | - [Porting information](README-porting.md) 46 | - [PSP](README-psp.md) 47 | - [Raspberry Pi](README-raspberrypi.md) 48 | - [Touch](README-touch.md) 49 | - [WinCE](README-wince.md) 50 | - [Windows](README-windows.md) 51 | - [WinRT](README-winrt.md) 52 | 53 | If you need help with the library, or just want to discuss SDL related 54 | issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php) 55 | 56 | If you want to report bugs or contribute patches, please submit them to 57 | [bugzilla](https://bugzilla.libsdl.org/) 58 | 59 | Enjoy! 60 | 61 | 62 | Sam Lantinga 63 | 64 | -------------------------------------------------------------------------------- /src/unused/pointers/PointersCRTP.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 04.09.19. 3 | // 4 | #include "PointersCRTP.hpp" 5 | #include "../../Pointers/Offsets.hpp" 6 | #include "ForeignPointerBuilderCRTP.hpp" 7 | 8 | auto PointersCRTP::localplayer() 9 | -> ForeignPtrOffset & { 10 | static auto p_localplayer = 11 | ForeignPtrBuilder::base(libNames::client) 12 | .add_offset(Offsets::client_localplayer, OffsetType::DEREFERENCE) 13 | .build(); 14 | // static ForeignLibraryPtrBase p_client_base(libNames::client); 15 | // static ForeignPtrOffset p_localplayer(p_client_base, Offsets::client_localplayer, OffsetType::DEREFERENCE); 16 | 17 | return p_localplayer; 18 | } 19 | 20 | auto PointersCRTP::player_punch() 21 | -> ForeignPtrOffset, Vec3f> & { 22 | // static auto p_player_punch = ForeignPtrBuilder::base(libNames::client); 23 | using localplayer_t = std::remove_reference_t; 24 | static ForeignPtrOffset p_player_punch(localplayer(), Offsets::client_punch_p_off, 25 | OffsetType::PLAIN_OFFSET); 26 | 27 | return p_player_punch; 28 | } 29 | 30 | auto PointersCRTP::doAttack() 31 | -> ForeignPtrOffset & { 32 | static ForeignLibraryPtrBase p_client_base(libNames::client); 33 | static ForeignPtrOffset p_doAttack(p_client_base, Offsets::client_doAttack, 34 | OffsetType::PLAIN_OFFSET); 35 | 36 | return p_doAttack; 37 | } 38 | 39 | auto PointersCRTP::op_on_update_viewAngle() -> ForeignPtrOffset & { 40 | static ForeignLibraryPtrBase p_engine_base(libNames::engine); 41 | static ForeignPtrOffset p_op_on_update_viewAngle_raw(p_engine_base, Offsets::engine_op_viewAngle_update, 42 | OffsetType::PLAIN_OFFSET); 43 | 44 | return p_op_on_update_viewAngle_raw; 45 | } 46 | 47 | auto PointersCRTP::op_on_update_viewAngleVis() -> ForeignPtrOffset & { 48 | static ForeignLibraryPtrBase p_client_base(libNames::client); 49 | static ForeignPtrOffset p_op_on_update_viewAngleVis_raw(p_client_base, Offsets::client_op_viewAngleVis_update, 50 | OffsetType::PLAIN_OFFSET); 51 | 52 | return p_op_on_update_viewAngleVis_raw; 53 | } -------------------------------------------------------------------------------- /todo_features: -------------------------------------------------------------------------------- 1 | TODO: 2 | - statemachines 3 | - top-level hack: 4 | o not injected 5 | o injected 6 | o not ingame 7 | o ingame -> hacks initialized 8 | o hack-menu -> game-input disabled 9 | o inside game-input (chat, console...) -> hack-input disabled 10 | - aimbot 11 | o Idle 12 | o 360::INIT 13 | o 360::TWIST 14 | o 360::DONE 15 | o Triggerbot 16 | - what about states, that can be/not be in any combination? Aimbot States Trigger/Aimbot Friendlyfire for example 17 | - central, generic user configuration. 18 | - features could register themselves in the configuration 19 | - changes to the config could propagate back to Features using Observer pattern 20 | - changes are made using the menu 21 | - i want to store my config in a file 22 | - log should hold all messages in memory, with timestamp 23 | - GUI should be able to display the messages 24 | - internal configuration header 25 | - log level 26 | - key bindings 27 | x offsets 28 | - aimbot 29 | - visibility check: radar? 30 | - enemy crouch check 31 | - bone/hitbox aim 32 | - triggerbot 33 | - auto knife 34 | auto right / left 35 | - log rewrite 36 | - flush() next to log() 37 | - remove #define DEFAULT_LOG_CHANNEL 38 | ? implement schwarz/nifty counter for lifetime-management 39 | - use exceptions for unrecoverable errors 40 | 41 | FIXME: 42 | - bunnyhop sometimes won't jump. Dirtily fixed by +jump. 43 | 44 | DONE: 45 | x aimbot 46 | x aimbot update on enemy pos update 47 | x fov restricted aim by distance 48 | x Logging should go to central, configurable space 49 | x silent 50 | x debug 51 | x stdout 52 | x error window 53 | x build VariableTweaker with ImGui 54 | x variable types: 55 | x sliding, numerical checkbox 56 | / default values 57 | x bi-directional callbacks on change 58 | x change toolchain from MSVC to CMake + Clang 59 | (for interop with Clion or Linux) 60 | x sigscanner using c++ stl 61 | 62 | DITCHED: 63 | - hack console 64 | - save to file 65 | - display ingame 66 | - display in external console window 67 | -------------------------------------------------------------------------------- /src/MemoryScanner/RegexSegmentScanner.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 19.10.19. 3 | // 4 | #pragma once 5 | #include 6 | #include 7 | 8 | #include "Utility.hpp" 9 | #include "Pointers/Signatures.hpp" 10 | 11 | class RegexSegmentScanner final { 12 | public: 13 | explicit RegexSegmentScanner(const SignatureAOI &signature) 14 | : _signature(signature) 15 | , _regex(BinaryRegex::from(signature)) 16 | { 17 | } 18 | 19 | auto scanSegment(std::string_view haystack, 20 | std::vector &matches) const -> void { 21 | std::cmatch results; 22 | std::regex_search(haystack.begin(), haystack.end(), results, _regex); 23 | 24 | for (size_t i = 0; i < results.size(); ++i) { 25 | const auto offset = results.position(i); 26 | auto *matchInSegment = haystack.data() + offset; 27 | auto *signatureAoiInSegment = matchInSegment + _signature.aoi_offset; 28 | auto signatureAoiInSegmentRaw = reinterpret_cast(signatureAoiInSegment); 29 | 30 | matches.push_back(signatureAoiInSegmentRaw); 31 | } 32 | } 33 | 34 | private: 35 | const SignatureAOI &_signature; 36 | const std::regex _regex; 37 | 38 | struct BinaryRegex { 39 | public: 40 | static auto from(const SignatureAOI &signature) -> std::regex { 41 | std::stringstream regex; 42 | auto &pattern = signature.signature.pattern(); 43 | auto &mask = signature.signature.mask(); 44 | for (size_t i = 0; i < pattern.size(); ++i) { 45 | if (mask[i] == SignatureMask::DONT_CARE) { 46 | appendUnknownByte(regex); 47 | } else { 48 | appendKnownByte(regex, pattern[i]); 49 | } 50 | } 51 | return std::regex(regex.str(), std::regex_constants::ECMAScript | std::regex_constants::optimize); 52 | } 53 | 54 | private: 55 | static auto appendUnknownByte(std::stringstream ®ex) -> void { 56 | // "[\\S\\s]" matches any character/byte 57 | regex << "[\\S\\s]"; 58 | } 59 | 60 | static auto appendKnownByte(std::stringstream ®ex, uint8_t byte) -> void { 61 | // "\xHH" matches a raw hex value HH 62 | regex << "\\x"; 63 | 64 | if(byte < 16) { 65 | regex << '0'; 66 | } 67 | 68 | regex << std::hex << std::uppercase; 69 | regex << static_cast(byte); 70 | regex << std::dec << std::nouppercase; 71 | } 72 | }; 73 | }; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-windows.md: -------------------------------------------------------------------------------- 1 | Windows 2 | ================================================================================ 3 | 4 | ================================================================================ 5 | OpenGL ES 2.x support 6 | ================================================================================ 7 | 8 | SDL has support for OpenGL ES 2.x under Windows via two alternative 9 | implementations. 10 | The most straightforward method consists in running your app in a system with 11 | a graphic card paired with a relatively recent (as of November of 2013) driver 12 | which supports the WGL_EXT_create_context_es2_profile extension. Vendors known 13 | to ship said extension on Windows currently include nVidia and Intel. 14 | 15 | The other method involves using the ANGLE library (https://code.google.com/p/angleproject/) 16 | If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile 17 | extension is found, SDL will try to load the libEGL.dll library provided by 18 | ANGLE. 19 | To obtain the ANGLE binaries, you can either compile from source from 20 | https://chromium.googlesource.com/angle/angle or copy the relevant binaries from 21 | a recent Chrome/Chromium install for Windows. The files you need are: 22 | 23 | * libEGL.dll 24 | * libGLESv2.dll 25 | * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler) 26 | or... 27 | * d3dcompiler_43.dll (supports Windows XP or later) 28 | 29 | If you compile ANGLE from source, you can configure it so it does not need the 30 | d3dcompiler_* DLL at all (for details on this, see their documentation). 31 | However, by default SDL will try to preload the d3dcompiler_46.dll to 32 | comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to 33 | support Windows XP) or to skip this step at all, you can use the 34 | SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details). 35 | 36 | Known Bugs: 37 | 38 | * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears 39 | that there's a bug in the library which prevents the window contents from 40 | refreshing if this is set to anything other than the default value. 41 | 42 | Vulkan Surface Support 43 | ============== 44 | 45 | Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application. 46 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_gesture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_gesture.h 24 | * 25 | * Include file for SDL gesture event handling. 26 | */ 27 | 28 | #ifndef SDL_gesture_h_ 29 | #define SDL_gesture_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "SDL_touch.h" 36 | 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef Sint64 SDL_GestureID; 45 | 46 | /* Function prototypes */ 47 | 48 | /** 49 | * \brief Begin Recording a gesture on the specified touch, or all touches (-1) 50 | * 51 | * 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); 54 | 55 | 56 | /** 57 | * \brief Save all currently loaded Dollar Gesture templates 58 | * 59 | * 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); 62 | 63 | /** 64 | * \brief Save a currently loaded Dollar Gesture template 65 | * 66 | * 67 | */ 68 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); 69 | 70 | 71 | /** 72 | * \brief Load Dollar Gesture templates from a file 73 | * 74 | * 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); 77 | 78 | 79 | /* Ends C function definitions when using C++ */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #include "close_code.h" 84 | 85 | #endif /* SDL_gesture_h_ */ 86 | 87 | /* vi: set ts=4 sw=4 expandtab: */ 88 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_error.h 24 | * 25 | * Simple error message routines for SDL. 26 | */ 27 | 28 | #ifndef SDL_error_h_ 29 | #define SDL_error_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Public functions */ 40 | /* SDL_SetError() unconditionally returns -1. */ 41 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 42 | extern DECLSPEC const char *SDLCALL SDL_GetError(void); 43 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 44 | 45 | /** 46 | * \name Internal error functions 47 | * 48 | * \internal 49 | * Private error reporting function - used internally. 50 | */ 51 | /* @{ */ 52 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 53 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 54 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) 55 | typedef enum 56 | { 57 | SDL_ENOMEM, 58 | SDL_EFREAD, 59 | SDL_EFWRITE, 60 | SDL_EFSEEK, 61 | SDL_UNSUPPORTED, 62 | SDL_LASTERROR 63 | } SDL_errorcode; 64 | /* SDL_Error() unconditionally returns -1. */ 65 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); 66 | /* @} *//* Internal error functions */ 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* SDL_error_h_ */ 75 | 76 | /* vi: set ts=4 sw=4 expandtab: */ 77 | -------------------------------------------------------------------------------- /src/unused/pointers/ForeignPointerBuilder_CompileTime.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 05.09.19. 3 | // 4 | #pragma once 5 | 6 | #include "ForeignPointer.hpp" 7 | 8 | namespace ForeignPointerBuilder { 9 | template 10 | SharedForeignPointer create(SharedForeignPointer basePtr, 11 | OffsetType lastOffsetType = OffsetType::PLAIN_OFFSET) { 12 | static_assert(sizeof...(offsets) > 0, "offset list is empty"); 13 | 14 | constexpr size_t N = sizeof...(offsets); 15 | std::array l_offsets = {offsets...}; 16 | 17 | auto offset = l_offsets[0]; 18 | bool onlyOneOffset = N == 1; 19 | OffsetType type = onlyOneOffset ? 20 | lastOffsetType : 21 | OffsetType::DEREFERENCE; 22 | SharedForeignPointer result 23 | = std::make_shared>(std::move(basePtr), offset, type); 24 | 25 | for (size_t i = 1; i < N; ++i) { 26 | 27 | ptrdiff_t offset = l_offsets[i]; 28 | bool lastOffset = i == N - 1; 29 | OffsetType type = lastOffset ? 30 | lastOffsetType : 31 | OffsetType::DEREFERENCE; 32 | 33 | 34 | result = std::make_shared>(std::move(result), offset, type); 35 | } 36 | 37 | return result; 38 | } 39 | 40 | template 41 | SharedForeignPointer create(SharedForeignPointer basePtr, 42 | OffsetType lastOffsetType = OffsetType::PLAIN_OFFSET) { 43 | return create(std::move(basePtr), lastOffsetType); 44 | } 45 | 46 | template 47 | SharedForeignPointer create(LibName const &libName, 48 | OffsetType lastOffsetType = OffsetType::PLAIN_OFFSET) { 49 | static_assert(sizeof...(offsets) > 0, "offset list is empty"); 50 | auto libraryPointer = std::make_shared(libName); 51 | return create(std::move(libraryPointer), 52 | lastOffsetType); 53 | } 54 | 55 | template 56 | SharedForeignPointer<> create(LibName const &libName, 57 | OffsetType lastOffsetType = OffsetType::PLAIN_OFFSET) { 58 | static_assert(sizeof...(offsets) > 0, "offset list is empty"); 59 | auto libraryPointer = std::make_shared(libName); 60 | return create(std::move(libraryPointer), 61 | lastOffsetType); 62 | } 63 | }; -------------------------------------------------------------------------------- /src/unused/pointers/Pointers.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 05.09.19. 3 | //s 4 | #include "Pointers.hpp" 5 | #include "GamePointerFactory.hpp" 6 | #include "Offsets.hpp" 7 | 8 | using namespace Offsets; 9 | using namespace libNames; 10 | 11 | namespace Pointers { 12 | std::shared_ptr> const &localplayer() { 13 | static auto p_localPlayer = GamePointerFactory::create(client, 14 | {client_localplayer}, 15 | OffsetType::DEREFERENCE); 16 | return p_localPlayer; 17 | } 18 | 19 | std::shared_ptr> const &player_pos() { 20 | static auto p = GamePointerFactory::create(engine, {engine_player_pos}); 21 | return p; 22 | } 23 | 24 | std::shared_ptr> const &player_angles() { 25 | static auto p = GamePointerFactory::create(engine, {engine_viewAngles}); 26 | return p; 27 | } 28 | 29 | std::shared_ptr> const &player_angles_vis() { 30 | static auto p = GamePointerFactory::create(client, {client_viewAngleVis}); 31 | return p; 32 | } 33 | 34 | std::shared_ptr> const &player_punch() { 35 | static auto p = GamePointerFactory::create(localplayer(), {client_punch_p_off}); 36 | return p; 37 | } 38 | 39 | std::shared_ptr> const &player_team() { 40 | static auto p = GamePointerFactory::create(localplayer(), {client_player_team_p_off}); 41 | return p; 42 | } 43 | 44 | std::shared_ptr>> &players() { 45 | static auto p = GamePointerFactory::create>(client, 46 | {client_player_p_base, 47 | client_player_p_off}); 48 | return p; 49 | } 50 | 51 | std::shared_ptr> &crosshair_target_id() { 52 | static auto p = GamePointerFactory::create(localplayer(), {client_target_id_p_off}); 53 | return p; 54 | } 55 | 56 | std::shared_ptr> const &doAttack() { 57 | static auto p = GamePointerFactory::create(client, {client_doAttack}); 58 | return p; 59 | } 60 | 61 | std::shared_ptr> const &op_on_viewAngle_update() { 62 | static auto p_op_on_update_viewAngle = GamePointerFactory::create(engine, {engine_op_viewAngle_update}); 63 | return p_op_on_update_viewAngle; 64 | } 65 | 66 | std::shared_ptr> const &op_on_viewAngleVis_update() { 67 | static auto p_op_on_update_viewAngleVis = GamePointerFactory::create(client, {client_op_viewAngleVis_update}); 68 | return p_op_on_update_viewAngleVis; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \brief The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * \brief Get the current power supply details. 54 | * 55 | * \param secs Seconds of battery life left. You can pass a NULL here if 56 | * you don't care. Will return -1 if we can't determine a 57 | * value, or we're not running on a battery. 58 | * 59 | * \param pct Percentage of battery life left, between 0 and 100. You can 60 | * pass a NULL here if you don't care. Will return -1 if we 61 | * can't determine a value, or we're not running on a battery. 62 | * 63 | * \return The state of the battery (if any). 64 | */ 65 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 66 | 67 | /* Ends C function definitions when using C++ */ 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #include "close_code.h" 72 | 73 | #endif /* SDL_power_h_ */ 74 | 75 | /* vi: set ts=4 sw=4 expandtab: */ 76 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_test_font.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_font.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_font_h_ 31 | #define SDL_test_font_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | #define FONT_CHARACTER_SIZE 8 42 | 43 | /** 44 | * \brief Draw a string in the currently set font. 45 | * 46 | * \param renderer The renderer to draw on. 47 | * \param x The X coordinate of the upper left corner of the character. 48 | * \param y The Y coordinate of the upper left corner of the character. 49 | * \param c The character to draw. 50 | * 51 | * \returns Returns 0 on success, -1 on failure. 52 | */ 53 | int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); 54 | 55 | /** 56 | * \brief Draw a string in the currently set font. 57 | * 58 | * \param renderer The renderer to draw on. 59 | * \param x The X coordinate of the upper left corner of the string. 60 | * \param y The Y coordinate of the upper left corner of the string. 61 | * \param s The string to draw. 62 | * 63 | * \returns Returns 0 on success, -1 on failure. 64 | */ 65 | int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); 66 | 67 | 68 | /** 69 | * \brief Cleanup textures used by font drawing functions. 70 | */ 71 | void SDLTest_CleanupTextDrawing(void); 72 | 73 | /* Ends C function definitions when using C++ */ 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | #include "close_code.h" 78 | 79 | #endif /* SDL_test_font_h_ */ 80 | 81 | /* vi: set ts=4 sw=4 expandtab: */ 82 | -------------------------------------------------------------------------------- /src/Visuals/Wallhack.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 29.06.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include "../Utility.hpp" 8 | 9 | class Wallhack : public Util::NonCopyable, public Util::NonMovable { 10 | public: 11 | Wallhack(); 12 | 13 | ~Wallhack(); 14 | 15 | private: 16 | // hook to library function 17 | // credit: https://aixxe.net/2016/12/imgui-linux-csgo 18 | using HRESULT = long; 19 | typedef enum D3DPRIMITIVETYPE { 20 | D3DPT_POINTLIST = 1, 21 | D3DPT_LINELIST = 2, 22 | D3DPT_LINESTRIP = 3, 23 | D3DPT_TRIANGLELIST = 4, 24 | D3DPT_TRIANGLESTRIP = 5, 25 | D3DPT_TRIANGLEFAN = 6, 26 | D3DPT_FORCE_DWORD = 0x7fffffff 27 | } D3DPRIMITIVETYPE, *LPD3DPRIMITIVETYPE; 28 | using DrawIndexedPrimitive_t = 29 | HRESULT (*)(uintptr_t, D3DPRIMITIVETYPE, int, unsigned, unsigned, unsigned, unsigned); 30 | 31 | struct IndexedPrimitive { 32 | IndexedPrimitive(D3DPRIMITIVETYPE d3Dprimitivetype, 33 | int BaseVertexIndex, 34 | unsigned MinVertexIndex, 35 | unsigned NumVertices, 36 | unsigned startIndex, 37 | unsigned primCount) 38 | : d3Dprimitivetype(d3Dprimitivetype) 39 | , BaseVertexIndex(BaseVertexIndex) 40 | , MinVertexIndex(MinVertexIndex) 41 | , NumVertices(NumVertices) 42 | , startIndex(startIndex) 43 | , primCount(primCount) {} 44 | 45 | D3DPRIMITIVETYPE d3Dprimitivetype; 46 | int BaseVertexIndex; 47 | unsigned MinVertexIndex; 48 | unsigned NumVertices; 49 | unsigned startIndex; 50 | unsigned primCount; 51 | 52 | auto operator<(IndexedPrimitive const &rhs) const -> bool { 53 | if (d3Dprimitivetype != rhs.d3Dprimitivetype) { 54 | return d3Dprimitivetype < rhs.d3Dprimitivetype; 55 | } else if (BaseVertexIndex != rhs.BaseVertexIndex) { 56 | return BaseVertexIndex < rhs.BaseVertexIndex; 57 | } else if (MinVertexIndex != rhs.MinVertexIndex) { 58 | return MinVertexIndex < rhs.MinVertexIndex; 59 | } else if (NumVertices != rhs.NumVertices) { 60 | return NumVertices < rhs.NumVertices; 61 | } else if (startIndex < rhs.startIndex) { 62 | return startIndex < rhs.startIndex; 63 | } else { 64 | return primCount < rhs.primCount; 65 | } 66 | } 67 | }; 68 | 69 | std::set m_indexedPrimitives; 70 | 71 | const uintptr_t m_shaderapidx9Base; 72 | const DrawIndexedPrimitive_t m_orig_DrawIndexedPrimitive; 73 | 74 | static auto getDrawIndexedPrimitive() -> DrawIndexedPrimitive_t; 75 | 76 | // hooking stuff 77 | auto installDrawIndexedPrimitiveHook() -> void; 78 | 79 | auto removeDrawIndexedPrimitiveHook() -> void; 80 | 81 | static auto hook_DrawIndexedPrimitive( 82 | uintptr_t thisptr, 83 | D3DPRIMITIVETYPE d3Dprimitivetype, 84 | int BaseVertexIndex, 85 | unsigned MinVertexIndex, 86 | unsigned NumVertices, 87 | unsigned startIndex, 88 | unsigned primCount) -> HRESULT; 89 | }; 90 | 91 | extern Wallhack *g_Wallhack; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2017 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_config_minimal_h_ 23 | #define SDL_config_minimal_h_ 24 | #define SDL_config_h_ 25 | 26 | #include "SDL_platform.h" 27 | 28 | /** 29 | * \file SDL_config_minimal.h 30 | * 31 | * This is the minimal configuration that can be used to build SDL. 32 | */ 33 | 34 | #define HAVE_STDARG_H 1 35 | #define HAVE_STDDEF_H 1 36 | 37 | /* Most everything except Visual Studio 2008 and earlier has stdint.h now */ 38 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 39 | /* Here are some reasonable defaults */ 40 | typedef unsigned int size_t; 41 | typedef signed char int8_t; 42 | typedef unsigned char uint8_t; 43 | typedef signed short int16_t; 44 | typedef unsigned short uint16_t; 45 | typedef signed int int32_t; 46 | typedef unsigned int uint32_t; 47 | typedef signed long long int64_t; 48 | typedef unsigned long long uint64_t; 49 | typedef unsigned long uintptr_t; 50 | #else 51 | #define HAVE_STDINT_H 1 52 | #endif /* Visual Studio 2008 */ 53 | 54 | #ifdef __GNUC__ 55 | #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 56 | #endif 57 | 58 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 59 | #define SDL_AUDIO_DRIVER_DUMMY 1 60 | 61 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 62 | #define SDL_JOYSTICK_DISABLED 1 63 | 64 | /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ 65 | #define SDL_HAPTIC_DISABLED 1 66 | 67 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 68 | #define SDL_LOADSO_DISABLED 1 69 | 70 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 71 | #define SDL_THREADS_DISABLED 1 72 | 73 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 74 | #define SDL_TIMERS_DISABLED 1 75 | 76 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 77 | #define SDL_VIDEO_DRIVER_DUMMY 1 78 | 79 | /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ 80 | #define SDL_FILESYSTEM_DUMMY 1 81 | 82 | #endif /* SDL_config_minimal_h_ */ 83 | -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/docs/README-directfb.md: -------------------------------------------------------------------------------- 1 | DirectFB 2 | ======== 3 | 4 | Supports: 5 | 6 | - Hardware YUV overlays 7 | - OpenGL - software only 8 | - 2D/3D accelerations (depends on directfb driver) 9 | - multiple displays 10 | - windows 11 | 12 | What you need: 13 | 14 | * DirectFB 1.0.1, 1.2.x, 1.3.0 15 | * Kernel-Framebuffer support: required: vesafb, radeonfb .... 16 | * Mesa 7.0.x - optional for OpenGL 17 | 18 | /etc/directfbrc 19 | 20 | This file should contain the following lines to make 21 | your joystick work and avoid crashes: 22 | ------------------------ 23 | disable-module=joystick 24 | disable-module=cle266 25 | disable-module=cyber5k 26 | no-linux-input-grab 27 | ------------------------ 28 | 29 | To disable to use x11 backend when DISPLAY variable is found use 30 | 31 | export SDL_DIRECTFB_X11_CHECK=0 32 | 33 | To disable the use of linux input devices, i.e. multimice/multikeyboard support, 34 | use 35 | 36 | export SDL_DIRECTFB_LINUX_INPUT=0 37 | 38 | To use hardware accelerated YUV-overlays for YUV-textures, use: 39 | 40 | export SDL_DIRECTFB_YUV_DIRECT=1 41 | 42 | This is disabled by default. It will only support one 43 | YUV texture, namely the first. Every other YUV texture will be 44 | rendered in software. 45 | 46 | In addition, you may use (directfb-1.2.x) 47 | 48 | export SDL_DIRECTFB_YUV_UNDERLAY=1 49 | 50 | to make the YUV texture an underlay. This will make the cursor to 51 | be shown. 52 | 53 | Simple Window Manager 54 | ===================== 55 | 56 | The driver has support for a very, very basic window manager you may 57 | want to use when running with "wm=default". Use 58 | 59 | export SDL_DIRECTFB_WM=1 60 | 61 | to enable basic window borders. In order to have the window title rendered, 62 | you need to have the following font installed: 63 | 64 | /usr/share/fonts/truetype/freefont/FreeSans.ttf 65 | 66 | OpenGL Support 67 | ============== 68 | 69 | The following instructions will give you *software* OpenGL. However this 70 | works at least on all directfb supported platforms. 71 | 72 | As of this writing 20100802 you need to pull Mesa from git and do the following: 73 | 74 | ------------------------ 75 | git clone git://anongit.freedesktop.org/git/mesa/mesa 76 | cd mesa 77 | git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a 78 | ------------------------ 79 | 80 | Edit configs/linux-directfb so that the Directories-section looks like 81 | ------------------------ 82 | # Directories 83 | SRC_DIRS = mesa glu 84 | GLU_DIRS = sgi 85 | DRIVER_DIRS = directfb 86 | PROGRAM_DIRS = 87 | ------------------------ 88 | 89 | make linux-directfb 90 | make 91 | 92 | echo Installing - please enter sudo pw. 93 | 94 | sudo make install INSTALL_DIR=/usr/local/dfb_GL 95 | cd src/mesa/drivers/directfb 96 | make 97 | sudo make install INSTALL_DIR=/usr/local/dfb_GL 98 | ------------------------ 99 | 100 | To run the SDL - testprograms: 101 | 102 | export SDL_VIDEODRIVER=directfb 103 | export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib 104 | export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 105 | 106 | ./testgl 107 | 108 | -------------------------------------------------------------------------------- /src/Visuals/ESP.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 29.06.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "../Utility.hpp" 15 | #include "DrawHook.hpp" 16 | #include "../Pointers/GameVars.hpp" 17 | #include "../Pointers/overlay_structs.hpp" 18 | 19 | struct SDL_Window; 20 | 21 | class GUI; 22 | 23 | class Aimbot; 24 | 25 | class ESP : public DrawHookSubscriber, public Util::NonCopyable, public Util::NonMovable { 26 | public: 27 | explicit ESP(GameVars gameVars, DrawHook &drawHook, GUI &gui, Aimbot &aimbot); 28 | 29 | ~ESP() override; 30 | 31 | auto onDraw(SDL_Window *window) -> void override; 32 | 33 | private: 34 | GameVars gameVars; 35 | DrawHook &m_drawHook; 36 | GUI &m_gui; 37 | Aimbot &m_aimbot; 38 | 39 | // configuration 40 | constexpr static float FAR_PLANE = 10e9, NEAR_PLANE = 0; 41 | float m_linewidth = 1.7; 42 | bool m_enableAimbotTargetCross; 43 | bool m_enableBulletPredictionCross; 44 | bool m_enableDrawFov; 45 | bool m_enableBoxESP; 46 | bool m_enableLineESP; 47 | bool m_enableFlagESP; 48 | glm::vec3 debugPlayerPos; 49 | glm::vec3 debugPlayerEuler; 50 | glm::vec3 debugAxesPos; 51 | int eulerVariant; 52 | float debugAxesScale; 53 | float fov_vertical_degrees_used; 54 | float* fov_vertical; 55 | float debugNear, debugFar; 56 | constexpr static SDL_Color colorT{255, 0, 0, 255}; // RED 57 | constexpr static SDL_Color colorCT{0, 0, 255, 255}; // BLUE 58 | constexpr static SDL_Color colorTflag{255, 255, 0, 255}; 59 | constexpr static SDL_Color colorCTflag{0, 255, 0, 255}; 60 | 61 | static glm::mat4 m_mat_unswizzle_game_coords; 62 | glm::mat4 m_mat_view; 63 | glm::mat4 m_mat_projection; 64 | 65 | auto calcMatView() -> glm::mat4; 66 | auto calcMatProjection() -> glm::mat4; 67 | 68 | auto debug() -> void; 69 | 70 | /** 71 | * Returns given position in screen coordinates, if visible 72 | * @param worldPos position in world space 73 | * @return screen x/y coordinates. std::nullopt if not on screen 74 | */ 75 | auto world_to_screen(glm::vec3 const &worldPos) const -> std::optional; 76 | 77 | auto drawCircleScreen(float cx, float cy, float r, int num_segments, const SDL_Color &color) const -> void; 78 | 79 | auto drawOriginAxes(float scale) const -> void; 80 | 81 | auto drawBox(glm::vec3 position, 82 | SDL_Color const &color, 83 | float height = 100.0f, 84 | float orientationYaw = 0.0f, 85 | float width = 100.0f) const -> void; 86 | 87 | auto drawScreenCross(glm::vec2 crossPos, float radius, const SDL_Color &color, 88 | bool diagonal = true, float lineToCenterRatio = 0.4) const -> void; 89 | 90 | auto drawLineESP() const -> void; 91 | 92 | auto drawBoxESP() const -> void; 93 | 94 | auto drawFlagESP() const -> void; 95 | auto drawBoxESP_matrixStacks() const -> void; 96 | 97 | auto drawAimFov() const -> void; 98 | 99 | auto drawAimbotTargetCross() const -> void; 100 | 101 | auto drawBulletPrediction() const -> void; 102 | }; -------------------------------------------------------------------------------- /lib/windows/SDL2-devel-2.0.10-VC/SDL2-2.0.10/include/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_loadso.h 24 | * 25 | * System dependent library loading routines 26 | * 27 | * Some things to keep in mind: 28 | * \li These functions only work on C function names. Other languages may 29 | * have name mangling and intrinsic language support that varies from 30 | * compiler to compiler. 31 | * \li Make sure you declare your function pointers with the same calling 32 | * convention as the actual library function. Your code will crash 33 | * mysteriously if you do not do this. 34 | * \li Avoid namespace collisions. If you load a symbol from the library, 35 | * it is not defined whether or not it goes into the global symbol 36 | * namespace for the application. If it does and it conflicts with 37 | * symbols in your code or other shared libraries, you will not get 38 | * the results you expect. :) 39 | */ 40 | 41 | #ifndef SDL_loadso_h_ 42 | #define SDL_loadso_h_ 43 | 44 | #include "SDL_stdinc.h" 45 | #include "SDL_error.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** 54 | * This function dynamically loads a shared object and returns a pointer 55 | * to the object handle (or NULL if there was an error). 56 | * The 'sofile' parameter is a system dependent name of the object file. 57 | */ 58 | extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); 59 | 60 | /** 61 | * Given an object handle, this function looks up the address of the 62 | * named function in the shared object and returns it. This address 63 | * is no longer valid after calling SDL_UnloadObject(). 64 | */ 65 | extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, 66 | const char *name); 67 | 68 | /** 69 | * Unload a shared object from memory. 70 | */ 71 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 72 | 73 | /* Ends C function definitions when using C++ */ 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | #include "close_code.h" 78 | 79 | #endif /* SDL_loadso_h_ */ 80 | 81 | /* vi: set ts=4 sw=4 expandtab: */ 82 | -------------------------------------------------------------------------------- /src/Pointers/Signatures.cpp: -------------------------------------------------------------------------------- 1 | #include "Signatures.hpp" 2 | #include "libNames.hpp" 3 | 4 | using namespace libNames; 5 | 6 | namespace Signatures { 7 | // bunnyhop 8 | #ifdef __linux__ 9 | SignatureAOI onGround_op_land = {client, { "83 05 ?? ?? ?? ?? 01 85 FF 74 40" }, 0, 7}; 10 | SignatureAOI onGround_op_leave = {client, { "83 2D ?? ?? ?? ?? 01 89 50 08 8B 43 08 8B 53 04" }, 0, 7}; 11 | SignatureAOI onGround = {client, onGround_op_leave.signature, 2, 4}; 12 | SignatureAOI doJump = {client, {"8B 3D ?? ?? ?? ?? 89 DA 83 CA 02 F7 C7 03 00 00 00 0F 45 DA"}, 2, 4}; 13 | 14 | SignatureAOI aimAngles_x_op_read = {engine, {"8D 74 26 00 55 8B 15 ?? ?? ?? ?? 89 E5 8B 45 0C 89 10"}, 5, 6}; 15 | SignatureAOI aimAngles = {engine, aimAngles_x_op_read.signature, 7, 4}; 16 | // sig points to last instruction where vis angles are written to. 17 | SignatureAOI aimAnglesVisual_update = {client, {"E8 ?? ?? ?? ?? F3 0F 10 06 F3 0F 58 83 28 0E 00 00 F3 0F 11 06 F3 0F 10 46 04 A1 ?? ?? ?? ?? ?? ?? ?? ?? 2C 0E 00 00 F3 0F 11 46 04 F3 0F 10 46 08 F3 0F 58 83 30 0E 00 00 F3 0F 11 46 08", }, 57, 5}; 18 | SignatureAOI localplayer_base = {client, { "8B 15 ?? ?? ?? ?? 85 D2 74 11 8B 02 89 14 24 FF 90" }, 2, 4}; 19 | SignatureAOI playerArray_base = {client, {"8B 15 ?? ?? ?? ?? 89 C3 31 C0 85 D2 74 24 8B 02"}, 2, 4}; 20 | SignatureAOI playerPos = {engine, {"F3 0F 10 9B E8 00 00 00 F3 0F 5C 2D ?? ?? ?? ??"}, 12, 4}; 21 | SignatureAOI doAttack_op_read = {client, {"8B 3D ?? ?? ?? ?? 89 DA 83 CA 01 F7 C7 03 00 00 00"}, 0, 6}; 22 | SignatureAOI doAttack = {client, doAttack_op_read.signature, 2, 4}; 23 | 24 | #else 25 | SignatureAOI onGround_op_land = { client, { "FF 05 ?? ?? ?? ?? 85 DB 74 0D 8B 13" }, 0, 6 }; 26 | SignatureAOI onGround_op_leave = { client, { "FF 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 5E 5D" }, 0, 6 }; 27 | SignatureAOI onGround = { client, onGround_op_leave.signature, 2, 4 }; 28 | SignatureAOI doJump = { client, { "89 0D ?? ?? ?? ?? 8B 0D ?? ?? ?? ?? F6 C1 03 74 03 83 CE 08" }, 2, 4 }; 29 | 30 | // aimbot 31 | /*old*/ SignatureAOI aimAngles_x_op_read = {engine, { "F3 0F 10 05 ?? ?? ?? ?? F3 0F 11 00 F3 0F 10 05 ?? ?? ?? ?? F3 0F 11 40 04 F3 0F 10 05 ?? ?? ?? ?? F3 0F 11 40 08 5D C2 04 00 B8" }, 0, 8}; 32 | /*old*/ SignatureAOI aimAngles = {engine, aimAngles_x_op_read.signature, 4, 4}; 33 | /*old*/ SignatureAOI aimAnglesVisual_update = { client, { "8B 5D 0C D9 00 D9 1B D9 40 04 D9 5B 04 D9 40 08 D9 5B 08" }, 3, 16 }; 34 | /*old*/ SignatureAOI localplayer_base = {client, { "33 C0 39 0D ?? ?? ?? ?? 0F 94 C0 C3" }, 4, 4}; 35 | /*old*/ SignatureAOI playerArray_base = {client, { "8B 0D ?? ?? ?? ?? 8B F0 85 C9 74 33 8B 11" }, 2, 4}; 36 | /*old*/ SignatureAOI playerPos = {engine, { "?? ?? ?? ?? 9F F6 C4 44 7A 2D F3 0F 10 47 04" }, 0, 4}; 37 | /*old*/ SignatureAOI doAttack_op_read = {client, { "8B 0D ?? ?? ?? ?? F6 C1 03 74 03 83 CE 01 A8 01" }, 0, 6}; 38 | /*old*/ SignatureAOI doAttack = { client, doAttack_op_read.signature, 2, 4 }; 39 | 40 | // input 41 | /*old*/ SignatureAOI sdl_pollEvent_caller = {inputsystem, { "E8 ?? ?? ?? ?? 83 C4 04 85 C0 74 18 8B FF 83 FE 64 7D 11" }, 0, 5}; 42 | #endif 43 | } -------------------------------------------------------------------------------- /src/DetourToCallback.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Utility.hpp" 8 | #include "Detour.hpp" 9 | #include "MemoryUtils.hpp" 10 | 11 | struct SignatureAOI; 12 | 13 | // stores all general purpose registers 14 | // source http://sparksandflames.com/files/x86InstructionChart.html 15 | struct PushAllRegisters { 16 | const uint8_t PUSH_EAX = 0x50; 17 | const uint8_t PUSH_ECX = 0x51; 18 | const uint8_t PUSH_EDX = 0x52; 19 | const uint8_t PUSH_EBX = 0x53; 20 | const uint8_t PUSH_ESI = 0x56; 21 | const uint8_t PUSH_EDI = 0x57; 22 | 23 | const uint8_t PUSHF = 0X9C; 24 | 25 | static void writeOpcodes(void *address) { 26 | new(address) PushAllRegisters; 27 | } 28 | }; 29 | 30 | // restores all general purpose registers 31 | // source http://sparksandflames.com/files/x86InstructionChart.html 32 | struct PopAllRegisters { 33 | const uint8_t POPF = 0X9D; 34 | 35 | const uint8_t POP_EDI = 0x5F; 36 | const uint8_t POP_ESI = 0x5E; 37 | const uint8_t POP_EBX = 0x5B; 38 | const uint8_t POP_EDX = 0x5A; 39 | const uint8_t POP_ECX = 0x59; 40 | const uint8_t POP_EAX = 0x58; 41 | 42 | static void writeOpcodes(void *address) { 43 | new(address) PopAllRegisters; 44 | } 45 | }; 46 | 47 | class DetourToCallback : public Util::NonCopyable, public Util::NonMovable { 48 | public: 49 | using callback = std::function; 50 | 51 | enum OLD_CODE_EXEC { 52 | CODE_BEFORE_DETOUR, 53 | CODE_AFTER_DETOUR, 54 | NO_EXEC 55 | }; 56 | 57 | DetourToCallback(); 58 | ~DetourToCallback(); 59 | 60 | auto install(const SignatureAOI& signature, 61 | callback callback, 62 | OLD_CODE_EXEC policy = CODE_AFTER_DETOUR) -> bool; 63 | 64 | auto install(uintptr_t insertion_addr, 65 | int opcodes_len, 66 | callback callback, 67 | OLD_CODE_EXEC policy = CODE_AFTER_DETOUR) -> bool; 68 | 69 | // returns true for the detour was successfully disabled or already disabled before 70 | auto remove() -> bool; 71 | auto isEnabled() const -> bool; 72 | 73 | private: 74 | enum MethodCallingConvention { 75 | push_on_stack, 76 | pass_by_ecx 77 | }; 78 | 79 | bool _enabled; 80 | callback _callback; 81 | std::vector _trampolineCodeBuf; 82 | std::optional _scopedTrampolineProtection; 83 | Detour _detourToTrampoline; 84 | 85 | // raw address of a non-static method 86 | template 87 | static auto _rawMethodAddress(void (Class::* method)(void) const) -> uintptr_t; 88 | 89 | // build assembly code that calls object.callbackMethod() at runtime 90 | auto _buildTrampoline(size_t opcodes_len, 91 | uintptr_t insertion_addr, 92 | OLD_CODE_EXEC policy) -> void; 93 | }; 94 | 95 | // raw address of a non-static callbackMethod 96 | template 97 | auto DetourToCallback::_rawMethodAddress(void (Class::* method)() const) -> uintptr_t { 98 | // clearly insane magic to get MSVC to hand the addresses of member functions 99 | // https://stackoverflow.com/questions/8121320/get-memory-address-of-member-function 100 | // simplified by 101 | // https://www.codeproject.com/Questions/1032379/how-to-print-the-address-of-a-member-function-usin 102 | uintptr_t rawAddress = reinterpret_cast(method); 103 | return rawAddress; 104 | } 105 | -------------------------------------------------------------------------------- /src/Utility.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 07.06.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include // uintptr_t, ptrdiff_t 9 | 10 | #include 11 | 12 | namespace Util { 13 | class NonCopyable { 14 | public: 15 | NonCopyable() = default; 16 | virtual ~NonCopyable() noexcept = default; 17 | 18 | NonCopyable(const NonCopyable&) = delete; 19 | NonCopyable(NonCopyable&&) = default; 20 | 21 | auto operator=(const NonCopyable&) -> NonCopyable& = delete; 22 | auto operator=(NonCopyable&&) -> NonCopyable& = default; 23 | }; 24 | 25 | class NonMovable { 26 | public: 27 | NonMovable() = default; 28 | virtual ~NonMovable() noexcept = default; 29 | 30 | NonMovable(const NonMovable&) = default; 31 | NonMovable(NonMovable&&) = delete; 32 | 33 | auto operator=(const NonMovable&) -> NonMovable& = default; 34 | auto operator=(NonMovable&&) -> NonMovable& = delete; 35 | }; 36 | 37 | // simple string split 38 | // source: https://www.bfilipek.com/2018/07/string-view-perf-followup.html 39 | // code: https://github.com/fenbf/StringViewTests/blob/master/StringViewTest.cpp 40 | auto split(std::string_view str, std::string_view delims = " ") -> std::vector; 41 | 42 | // returns the filename of given path 43 | // taken from https://www.oreilly.com/library/view/c-cookbook/0596007612/ch10s15.html 44 | auto get_filename(std::string_view path) -> std::string_view; 45 | 46 | auto toRadians(float degrees) -> float; 47 | 48 | auto toDegrees(float radians) -> float; 49 | 50 | auto rotateAroundZ(glm::vec3 const &vec, float yawDegrees) -> glm::vec3; 51 | 52 | auto viewAnglesToUnitvector(glm::vec3 const &angles) -> glm::vec3; 53 | 54 | // returns the angle between given vectors in degrees 55 | auto degreesBetweenVectors(const glm::vec3 &a, const glm::vec3 &b) -> float; 56 | 57 | class Offset final { 58 | public: 59 | constexpr explicit Offset(ptrdiff_t offset) : _offset{ offset } {} 60 | constexpr operator ptrdiff_t() const { return _offset; } 61 | 62 | constexpr auto operator+(ptrdiff_t offset) const -> Offset { return Offset{ _offset + offset }; } 63 | constexpr auto operator-(ptrdiff_t offset) const -> Offset { return Offset{ _offset - offset }; } 64 | constexpr auto operator+=(ptrdiff_t offset) -> Offset& { _offset += offset; return *this; } 65 | constexpr auto operator-=(ptrdiff_t offset) -> Offset& { _offset -= offset; return *this; } 66 | 67 | private: 68 | ptrdiff_t _offset; 69 | }; 70 | 71 | class Address final { 72 | public: 73 | constexpr explicit Address(uintptr_t address) : _address{ address } {} 74 | constexpr operator uintptr_t const& () const { return _address; } 75 | 76 | constexpr auto operator+(Offset offset) const -> Address { return Address{ _address + offset }; } 77 | constexpr auto operator-(Offset offset) const -> Address { return Address{ _address - offset }; } 78 | constexpr auto operator+=(Offset offset) -> Address& { _address += offset; return *this; } 79 | constexpr auto operator-=(Offset offset) -> Address& { _address -= offset; return *this; } 80 | 81 | constexpr auto operator-(Address address) const -> Offset { return Offset{ static_cast(_address - address) }; } 82 | 83 | template 84 | constexpr auto as_pointer() const -> T* { return reinterpret_cast(_address); } 85 | 86 | private: 87 | uintptr_t _address; 88 | }; 89 | } 90 | -------------------------------------------------------------------------------- /src/unused/ApiInterceptor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by therdel on 11.07.19. 3 | // 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include // std::memcpy 9 | 10 | #include "../Detour.hpp" 11 | 12 | template 16 | class ApiInterceptor; 17 | 18 | template 22 | class ApiInterceptor { 23 | static_assert(opcodes_len >= 5); 24 | public: 25 | using function_pointer = _Res(*)(_ArgTypes...); 26 | private: 27 | const function_pointer m_orig_function_pointer; 28 | 29 | std::vector m_orig_function_trampoline; 30 | std::optional m_scoped_trampoline_protection; 31 | Detour m_detour; 32 | 33 | public: 34 | explicit ApiInterceptor(function_pointer original) 35 | : m_orig_function_pointer(original) 36 | , m_orig_function_trampoline(opcodes_len, 0x90) { 37 | std::memcpy((void *) m_orig_function_trampoline.data(), 38 | (void *) original, 39 | opcodes_len); 40 | 41 | // TODO: dirty hack time, works for SDL_PollEvent ONLY LOL HAHAHA 42 | std::memset((void*)&m_orig_function_trampoline[4], 43 | 0x90, 5); 44 | m_orig_function_trampoline[4] = 0x8B; 45 | m_orig_function_trampoline[5] = 0x1C; 46 | m_orig_function_trampoline[6] = 0x24; 47 | 48 | 49 | // make our buffer executable - write access is also crucial 50 | // TODO? RESEARCH why do we need write access 51 | m_scoped_trampoline_protection = MemoryUtils::scoped_remove_memory_protection( 52 | (uintptr_t) m_orig_function_trampoline.data(), 53 | m_orig_function_trampoline.size()); 54 | if (!m_scoped_trampoline_protection.has_value()) { 55 | // unable to change memory protection of code segment 56 | Log::log("ApiInterceptor: Failed to enable execute permissions on code buf"); 57 | throw std::runtime_error("ApiInterceptor: Failed to enable execute permissions on code buf"); 58 | } 59 | } 60 | 61 | bool interceptTo(function_pointer interceptor) { 62 | auto addr_interceptor = reinterpret_cast(interceptor); 63 | auto addr_functionOrig = reinterpret_cast(m_orig_function_pointer); 64 | return m_detour.install(addr_functionOrig, addr_interceptor); 65 | } 66 | 67 | void disable() { 68 | m_detour.disable(); 69 | } 70 | 71 | ~ApiInterceptor() { 72 | disable(); 73 | 74 | // TODO implement wait before removing execution rights? 75 | // this will crash when disable is called 76 | // while the trampoline/handler is still being executed 77 | 78 | // remove trampoline execution rights 79 | if (!m_scoped_trampoline_protection->restore()) { 80 | // restoring old memory protection failed 81 | Log::log("ApiInterceptor: Failed to restore previous permissions on trampoline"); 82 | } 83 | } 84 | 85 | function_pointer getTrampoline() const { 86 | return reinterpret_cast(m_orig_function_trampoline.data()); 87 | } 88 | 89 | _Res callTrampoline(_ArgTypes &&... args) const { 90 | std::cout << "callTramp" << std::endl; 91 | function_pointer orig_pointer = getTrampoline(); 92 | return orig_pointer(std::forward<_ArgTypes>(args)...); 93 | } 94 | }; -------------------------------------------------------------------------------- /src/Log.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include // stringstream 6 | #include 7 | #include 8 | #include 9 | 10 | class Log { 11 | public: 12 | enum class Channel { 13 | MESSAGE_BOX, 14 | STD_OUT, 15 | SILENT 16 | }; 17 | 18 | enum LogTime { 19 | LATER, 20 | FLUSH 21 | }; 22 | 23 | ~Log(); 24 | 25 | // stopEventProcessing logging thread 26 | static auto stop() -> void; 27 | 28 | // log with custom log level 29 | template 30 | static auto log(Channel level, const Args &...args) -> void { 31 | if (level == Channel::SILENT) { 32 | // do nothing 33 | return; 34 | } 35 | 36 | std::stringstream message; 37 | addToStream(message, args...); 38 | LogJob l_job(level, message.str()); 39 | // if (level == Channel::MESSAGE_BOX) { 40 | if constexpr (time == LogTime::LATER) { 41 | // lazy initialization on first log use 42 | // TODO put into lessons 43 | // important to place the log static into get(), because the log function is templated 44 | // and thus generates a Log object for per call with different template types 45 | Log &instance = get(); 46 | if (instance.m_do_stop == false) { 47 | instance.logLater(std::move(l_job)); 48 | } else { 49 | instance.doLog(std::move(l_job)); 50 | } 51 | } else { 52 | doLog(l_job); 53 | } 54 | } 55 | 56 | // log with default log level 57 | template 58 | static auto log(const Args &...args) -> void { 59 | Channel default_level; 60 | 61 | // TODO only gets set once at first include because of include barrier 62 | #ifdef DEFAULT_LOG_CHANNEL 63 | default_level = DEFAULT_LOG_CHANNEL; 64 | #else 65 | default_level = Channel::SILENT; 66 | #endif 67 | 68 | log