cs2-external-esp

repository·main·Indexed 18 days ago

https://github.com/imxnoobx/cs2-external-esp

A modernized external Extra Sensory Perception (ESP) tool for Counter-Strike 2. It features automatic offset scanning, a redesigned UI, and improved performance. The project includes a singleton-based architecture for its Engine, Config, Menu, and Overlays systems, utilizes DirectX 11 and ImGui for rendering, and implements a version-checking Updater class to monitor software safety and updates.

Tokens
3.3K
Snippets
13
Records
19
Agent score
68%

What's inside cs2-external-esp

  1. Important usage and security notes

    main

    Detection and Safety

    • Detection Status: The project is intended for single-player use. While no ban reports have been raised for other modes, use it at your own risk.
    • Anti-Virus Alerts: The software may be flagged by anti-virus programs because it accesses the memory of other processes. To ensure safety, it is encouraged to read the source code and build the project yourself using the Developer Instructions.

    License

    This project is licensed under CC BY-NC 4.0. You may share and adapt the material provided you give appropriate attribution and do not use it for commercial purposes.

  2. Build CS2 External ESP from source

    main

    To build the project manually using Visual Studio, follow these steps:

    1. Clone the repository with submodules: It is critical to use the --recursive flag to ensure all dependencies are included.

      git clone --recursive https://github.com/IMXNOOBX/cs2-external-esp

      Note: If you have already cloned the repository without submodules, run: git submodule update --init --recursive

    2. Compile with Visual Studio:

      • Open the project in Visual Studio 2022 (or later).
      • Set the build configuration to x64 - Release.
    3. Locate the binary: The compiled executable will be located in the <arch>/<configuration> directory, for example: x64/Release.

    git clone --recursive https://github.com/IMXNOOBX/cs2-external-esp
  3. Run CS2 External ESP

    main

    To use the application, follow these steps:

    1. Download the latest release from the Releases tab or build it from source.
    2. Launch Counter-Strike 2.
    3. Launch cs2-external-esp.exe.

    Requirements & Troubleshooting:

  4. Manage Menu tabs and navigation

    main

    The menu system is organized into three primary tabs, each identified by a Tab enum value. These tabs are used to categorize different ESP and game settings:

    • Tab::PLAYER: Player-related settings.
    • Tab::WORLD: World-related settings.
    • Tab::SETTINGS: General application settings.

    Each tab is associated with a human-readable label and an icon from the Icons asset library.

    enum Tab {
        PLAYER,
        WORLD,
        SETTINGS
    };
    
    static const TabItem tabs[] =
    {
        { Tab::PLAYER,      "Player",   Icons::PERSON },
        { Tab::WORLD,       "World",    Icons::GLOBE },
        { Tab::SETTINGS,    "Settings", Icons::SETTINGS }
    };
  5. Use WindowAffinity for window protection

    main

    The WindowAffinity enum defines how the window interacts with system capture and visibility:

    • WindowAffinity::Disabled: Standard window behavior.
    • WindowAffinity::Black: Renders the window as a black box in screen captures (useful for preventing screenshots/recordings from seeing the ESP).
    • WindowAffinity::Invisible: Makes the window invisible to capture software.
    // Example: Setting the window to be black in screenshots
    Window::SetAffinity(Window::hwnd, WindowAffinity::Black);
  6. Manage the rendering lifecycle with the Window class

    main

    The Window class provides static methods to manage the DirectX 11 device, the application window, and the ImGui context. To use the rendering system, you must follow a specific lifecycle: initialize the device, spawn the window, initialize ImGui, and then enter a loop that calls StartRender() and EndRender() for each frame.

    Lifecycle sequence:

    1. CreateDevice(): Initializes the D3D11 device and swap chain.
    2. SpawnWindow(): Creates the OS-level window.
    3. CreateImGui(): Sets up the ImGui context and backends.
    4. StartRender() / EndRender(): Wraps the frame rendering logic.
    5. DestroyImGui() / DespawnWindow() / DestroyDevice(): Cleanup in reverse order.
    if (Window::CreateDevice() && Window::SpawnWindow() && Window::CreateImGui()) {
        while (Window::shouldRun) {
            Window::StartRender();
            
            // Perform ImGui rendering/logic here
            
            Window::EndRender();
        }
        Window::DestroyImGui();
        Window::DespawnWindow();
        Window::DestroyDevice();
    }
  7. Use the Updater class to manage software updates

    main

    The Updater class provides a static interface for initializing and processing software updates. It checks the current version against a remote status JSON located at https://github.com/IMXNOOBX/cs2-external-esp/raw/refs/heads/main/.github/status.json to determine if the software is safe to use or requires an update.

    To use the updater, call Updater::Init() to set up the connection and Updater::Process() to execute the update logic. You can check the current update state using Updater::GetStatus().

    // Initialize the updater
    if (Updater::Init()) {
        // Process updates/status
        Updater::Process();
    
        // Check the current status
        Status currentStatus = Updater::GetStatus();
        if (currentStatus.unsafe) {
            // Handle unsafe version or notice
        }
    }
  8. Manage application configuration with the Config class

    main

    The Config class provides a singleton interface for managing application settings via JSON. It handles reading from and writing to the configuration storage. Use Config::Read() to load settings into the application and Config::Write() to persist current settings to disk. Access the active configuration instance using Config::GetInstance().

    // Loading configuration
    if (Config::Read()) {
        // Configuration loaded successfully
    }
    
    // Accessing the singleton instance
    Config& config = Config::GetInstance();
    
    // Saving configuration changes
    Config::Write();
  9. Access the game process and modules via Engine

    main

    Once initialized, you can retrieve handles to the game process and its core modules using the following static methods:

    • GetProcess(): Returns a std::shared_ptr<pProcess> representing the game process.
    • GetClient(): Returns a ProcessModule for the game's client module (e.g., client.dll).
    • GetEngine(): Returns a ProcessModule for the game's engine module (e.g., engine2.dll).
    auto process = Engine::GetProcess();
    auto clientModule = Engine::GetClient();
    auto engineModule = Engine::GetEngine();
  10. Serialize and deserialize colors and vectors in JSON

    main

    The Config class includes static utility methods for converting complex types to and from nlohmann::json objects. These are used to ensure consistent formatting for colors and 2D vectors within the configuration file.

    Color Conversion

    • JsonToColor(const json& parent, const std::string& key, const color_t& def): Extracts a color from the JSON object at the specified key. Returns def if the key is missing or invalid.
    • ColorToJson(json& parent, const std::string& key, const color_t& color): Serializes a color_t object into the JSON object under the specified key.

    Vector Conversion

    • JsonToVec2(const json& parent, const std::string& key, const Vec2_t& def): Extracts a Vec2_t from the JSON object at the specified key. Returns def if the key is missing or invalid.
    • Vec2ToJson(json& parent, const std::string& key, const Vec2_t& vec): Serializes a Vec2_t object into the JSON object under the specified key.