# hary309/hry-core architecture

> Architecture diagram of the GitHub repository hary309/hry-core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hary309/hry-core
- Repository: https://github.com/hary309/hry-core

## Overview

##### Main components of the system
- Plugin API and Core Interface – Core components (Core.cpp/hpp, Plugin.hpp, PluginInfo.hpp) that expose the framework’s functionality.
- UI & Rendering – Modules under “UI”, “Renderer” and ImGui integration (ImGuiImplEvents, UI pages). Indicate both renderer implementations: D3D11 and OpenGL.
- Configuration – Handling settings, with directories “include/Hry/Config” and “src/Config”, plus the fields mechanism (BoolField, NumericField, etc.) for plugin settings.
- Event System – Components under “include/Hry/Events” and “src/Events” (and nested Proxies for DInput8, Telemetry, WndProc, etc.) that facilitate event dispatching and handling.
- Input / KeyBinding – Code in “include/Hry/KeyBinding” and “src/KeyBinding”.
- Logger – Using “include/Hry/Logger” and “src/Logger” to capture logging functionality.
- Memory and Hooking – Components under “include/Hry/Memory” and “src/Memory”, plus the hooks in “src/Hooks”, to facilitate detouring and function hooking.
- SCSSDK Integration – Modules and channels in “include/Hry/SCSSDK” and “src/SCSSDK” for wrapping game telemetry channels (e.g., truck, trailer, job) and events.
- Modules – General plugin module management in “src/Modules” that handles dynamic or systematic extensions.
- Utilities – Supporting libraries under “include/Hry/Utils” and “src/Utils” for general helper functions, delegate patterns, task scheduling, hashing, etc.

##### Establish Relationships and Data Flow
- The Core/Plugin API serves as the central hub interfacing with all other systems.
- The UI layer consumes the rendering engine (which could be either DirectX 11 or OpenGL, depending on the chosen hook) and thus communicates with the lower-level Hooks.
- The Event system is tightly integrated with both the input handlers (like KeyBinding and system devices) and SCSSDK channels (telemetry data and gameplay events).
- The Config Manager collects settings via configuration fields, which are exposed to the UI for runtime changes.
- Logger sits as an independent component, accessible by most modules to record events or errors.
- Memory manipulation (Detour, Pattern Scanning, Hooks) is used to set up the necessary hooks in the game engine; these in turn feed data/events into the Event and UI systems.
- The Modules layer may depend on all of the above to enable or disable specific functionalities within a plugin.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Each directory (e.g., Config, Events, Logger) reflects modular design. The API breaks the system into distinct layers.
- Plugin architecture: The framework is designed so that plugins can be developed on top of the core, enabled by the Module Manager.
- Event-driven design: With a robust event system (dispatchers and proxies), the software leverages callbacks and messaging mechanisms.
- Abstraction for rendering and haptic input: Supports different rendering backends and input handling mechanisms by abstracting implementation details.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Core / Plugin API Subgraph
    subgraph "Core/Plugin API"
        Core["Core"]
        PluginInterface["Plugin Interface"]
    end

    %% UI & Rendering Subgraph
    subgraph "UI & Rendering"
        UIComponents["UI Components"]
        ImGuiInt["ImGui Integration"]
        D3D11["D3D11 Renderer"]
        OpenGL["OpenGL Renderer"]
    end

    %% Configuration Subgraph
    subgraph "Configuration"
        ConfigHeaders["Config Headers"]
        ConfigImpl["Config Implementations"]
        ConfigManager["Config Manager"]
    end

    %% Event System Subgraph
    subgraph "Event System"
        EventHeaders["Event Headers"]
        EventImpl["Event Implementations"]
        EventProxies["Event Proxies"]
    end

    %% Input / KeyBinding Subgraph
    subgraph "Input/KeyBinding"
        KBHeaders["KeyBinding Headers"]
        KBImpl["KeyBinding Implementations"]
    end

    %% Logger
    Logger["Logger"]

    %% Memory & Hooking Subgraph
    subgraph "Memory & Hooking"
        MemoryHeaders["Memory Headers"]
        MemoryImpl["Memory Implementations"]
        Hooks["Hooks"]
    end

    %% SCSSDK Integration Subgraph
    subgraph "SCSSDK Integration"
        SCSSDKHeaders["SCSSDK Headers"]
        SCSSDKImpl["SCSSDK Implementations"]
    end

    %% Modules
    Modules["Modules"]

    %% Utilities Subgraph
    subgraph "Utilities"
        UtilsHeaders["Utils Headers"]
        UtilsImpl["Utils Implementations"]
    end

    %% Core API connections to all subsystems
    Core -->|"interfaces"| UIComponents
    Core -->|"interfaces"| ConfigManager
    Core -->|"interfaces"| EventImpl
    Core -->|"interfaces"| KBImpl
    Core -->|"interfaces"| Logger
    Core -->|"interfaces"| MemoryImpl
    Core -->|"interfaces"| SCSSDKImpl
    Core -->|"interfaces"| Modules
    Core -->|"interfaces"| UtilsImpl

    PluginInterface -->|"exposes Plugin Info"| Core

    %% Additional Interactions
    MemoryImpl -->|"hooksFeed"| EventImpl
    KBImpl -->|"sendsInput"| EventImpl
    EventImpl -->|"dispatches"| UIComponents
    ConfigManager -->|"updatesSettings"| UIComponents
    MemoryImpl -->|"rendersData"| UIComponents
    EventImpl -->|"integrates"| SCSSDKImpl
    Modules -->|"logsModuleEvents"| Logger

    %% Styles and Colors
    classDef core fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef ui fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef config fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
    classDef events fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef input fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef logger fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef memory fill:#D1F2EB,stroke:#17A589,stroke-width:2px;
    classDef scssdk fill:#FCF3CF,stroke:#B9770E,stroke-width:2px;
    classDef modules fill:#EBDEF0,stroke:#8E44AD,stroke-width:2px;
    classDef utils fill:#FDEDEC,stroke:#E74C3C,stroke-width:2px;

    %% Assign classes to nodes
    class Core,PluginInterface core;
    class UIComponents,ImGuiInt,D3D11,OpenGL ui;
    class ConfigHeaders,ConfigImpl,ConfigManager config;
    class EventHeaders,EventImpl,EventProxies events;
    class KBHeaders,KBImpl input;
    class Logger logger;
    class MemoryHeaders,MemoryImpl,Hooks memory;
    class SCSSDKHeaders,SCSSDKImpl scssdk;
    class Modules modules;
    class UtilsHeaders,UtilsImpl utils;

    %% Click Events for Plugin API and Core Interface
    click Core "https://github.com/hary309/hry-core/blob/master/src/Core.cpp"
    click PluginInterface "https://github.com/hary309/hry-core/blob/master/include/Hry/Plugin.hpp"

    %% Click Events for UI & Rendering
    click UIComponents "https://github.com/hary309/hry-core/tree/master/src/UI"
    click ImGuiInt "https://github.com/hary309/hry-core/blob/master/src/ImGuiImplEvents.cpp"
    click D3D11 "https://github.com/hary309/hry-core/blob/master/src/Renderer/D3D11RendererImpl.cpp"
    click OpenGL "https://github.com/hary309/hry-core/blob/master/src/Renderer/OpenGLRendererImpl.cpp"

    %% Click Events for Configuration
    click ConfigHeaders "https://github.com/hary309/hry-core/tree/master/include/Hry/Config"
    click ConfigImpl "https://github.com/hary309/hry-core/tree/master/src/Config"
    click ConfigManager "https://github.com/hary309/hry-core/blob/master/src/Config/ConfigManager.cpp"

    %% Click Events for Event System
    click EventHeaders "https://github.com/hary309/hry-core/tree/master/include/Hry/Events"
    click EventImpl "https://github.com/hary309/hry-core/tree/master/src/Events"
    click EventProxies "https://github.com/hary309/hry-core/tree/master/src/Events/Proxies"

    %% Click Events for Input / KeyBinding
    click KBHeaders "https://github.com/hary309/hry-core/tree/master/include/Hry/KeyBinding"
    click KBImpl "https://github.com/hary309/hry-core/tree/master/src/KeyBinding"

    %% Click Event for Logger
    click Logger "https://github.com/hary309/hry-core/blob/master/include/Hry/Logger/Logger.hpp"

    %% Click Events for Memory & Hooking
    click MemoryHeaders "https://github.com/hary309/hry-core/tree/master/include/Hry/Memory"
    click MemoryImpl "https://github.com/hary309/hry-core/tree/master/src/Memory"
    click Hooks "https://github.com/hary309/hry-core/tree/master/src/Hooks"

    %% Click Events for SCSSDK Integration
    click SCSSDKHeaders "https://github.com/hary309/hry-core/tree/master/include/Hry/SCSSDK"
    click SCSSDKImpl "https://github.com/hary309/hry-core/tree/master/src/SCSSDK"

    %% Click Event for Modules
    click Modules "https://github.com/hary309/hry-core/tree/master/src/Modules"

    %% Click Events for Utilities
    click UtilsHeaders "https://github.com/hary309/hry-core/tree/master/include/Hry/Utils"
    click UtilsImpl "https://github.com/hary309/hry-core/tree/master/src/Utils"
```
