# thirteenag/iii.vc.sa.iv.project2dfx architecture

> Architecture diagram of the GitHub repository thirteenag/iii.vc.sa.iv.project2dfx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thirteenag/iii.vc.sa.iv.project2dfx
- Repository: https://github.com/thirteenag/iii.vc.sa.iv.project2dfx

## Overview

##### Project type and purpose
- Project2DFX is a native-code plugin framework written in C++ that injects into various GTA titles (III, VC, SA, IV, LCS, VCS) to enhance LOD corona rendering.
- It also includes a standalone data-grabber tool (“2DFXDataGrabber”) to extract game data archives, plus configuration files and build scripts.

##### File structure
- Top-level:
- premake5.lua/bat/exe – cross-platform build orchestration
- includes/ – header + C++ helpers + the entire RwSDK
- source/ – subfolders per game: each contains plugin entrypoint (dllmain.cpp) and CSearchlights logic
- external/ – submodules for IniReader, hooking, injector
- data/ – prebuilt tools (7za.exe), 2DFXDataGrabber binaries + data archives, LOD lights .ini/.dat files
- resources/ – VersionInfo for Windows resources
- readme.md, license, CI configs
- Patterns:
- Plugin per game → separate DLLs built from nearly identical code bases
- Shared engine code in includes/ and external/
- Standalone CLI utility (DataGrabber) in source/2DFXDataGrabber
- Build managed by Premake to generate Visual Studio/AppVeyor/etc. projects

##### README for additional insights
- Confirms multi-game support, plugin nature, release artifacts (DLLs per game + data archives).

##### Elements
- Build dependencies (Premake → compile → outputs)
- Runtime call/injection flow (GTA.exe → Injector → Plugin → RwSDK → GPU)
- Data file loading (Plugin → IniReader → data/*.ini, .dat)
- DataGrabber → 7za.exe → extracted archives
- Runtime components in another (e.g., green)
- Data assets in yellow
- Legends or annotations for:
- “Per-game plugin modules”
- Shared code vs per-game specialization
- DataGrabber workflow

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build System
    subgraph "Build System"
        direction TB
        subgraph "Premake Tools"
            direction TB
            PMLUA["premake5.lua"]:::build
            PMBAT["premake5.bat"]:::build
            PMEXE["premake5.exe"]:::build
        end
        subgraph "CI Configurations"
            direction TB
            AVY["appveyor.yml"]:::build
            GHA[".github/workflows/main.yml"]:::build
        end
    end

    %% Core Libraries
    subgraph "Core Libraries"
        direction TB
        RwSDK["RwSDK (RenderWare)"]:::ext
        IniR["IniReader"]:::ext
        HookLib["Hooking Library"]:::ext
        InjLib["Injector Library"]:::ext
        subgraph "Shared Helpers"
            direction TB
            Helper1["CLODLightManager.cpp"]:::ext
            Helper2["CLODLightManager.h"]:::ext
            Helper3["CLODLights.cpp"]:::ext
            Helper4["CLODLights.h"]:::ext
            Helper5["Sprite.cpp"]:::ext
            Helper6["Sprite.h"]:::ext
        end
    end

    %% Plugin Modules
    subgraph "Plugin Modules (DLLs)"
        direction TB
        subgraph "GTA III / VC / SA"
            IIIDLL["/source/IIILodLights/dllmain.cpp"]:::runtime
            IIISL_Cpp["/source/IIILodLights/CSearchlights.cpp"]:::runtime
            IIISL_H["/source/IIILodLights/CSearchlights.h"]:::runtime
        end
        subgraph "GTA IV"
            IVDLL["/source/IVLodLights/dllmain.cpp"]:::runtime
        end
        subgraph "GTA San Andreas"
            SADLL["/source/SALodLights/dllmain.cpp"]:::runtime
            SASL_Cpp["/source/SALodLights/CSearchlights.cpp"]:::runtime
            SASL_H["/source/SALodLights/CSearchlights.h"]:::runtime
        end
        subgraph "GTA Vice City"
            VCDLL["/source/VCLodLights/dllmain.cpp"]:::runtime
            VCSL_Cpp["/source/VCLodLights/CSearchlights.cpp"]:::runtime
            VCSL_H["/source/VCLodLights/CSearchlights.h"]:::runtime
        end
    end

    %% DataGrabber Utility
    subgraph "DataGrabber Utility"
        direction TB
        DG_SRC["/source/2DFXDataGrabber/2DFXDataGrabber.cpp"]:::build
        DG_BIN["/data/2DFXDataGrabber/SA2dfx.exe"]:::data
        DG_DOC["/data/2DFXDataGrabber/howto.txt"]:::data
    end

    %% Data Assets
    subgraph "Data Assets"
        direction TB
        IIIDATA["/data/IIILodLights/"]:::data
        IVDATA["/data/IVLodLights/"]:::data
        SADATA["/data/SALodLights/"]:::data
        VCDATA["/data/VCLodLights/"]:::data
        ARCH["/data/2DFXDataGrabber/*.7z, *.zip"]:::data
        Z7["/data/7za.exe"]:::data
    end

    %% Resources
    subgraph "Resources"
        direction TB
        VersionH["/resources/VersionInfo.h"]:::data
        VersionRC["/resources/VersionInfo.rc"]:::data
    end

    %% Runtime Flow
    subgraph "Runtime Flow"
        direction TB
        GTAEXE["GTA.exe (Host Process)"]:::runtime
        Injector["Injector Library"]:::ext
        Hooking["Hooking Library"]:::ext
        PluginDLL["Plugin DLL"]:::runtime
        RwRuntime["RwSDK"]:::ext
        GPU["GPU Rendering"]:::runtime
    end

    %% Build Flow Connections
    PMLUA -->|"Generates projects"| Compiler["Compiler/IDE"]:::build
    PMBAT --> Compiler
    PMEXE --> Compiler
    AVY --> Compiler
    GHA --> Compiler
    Compiler -->|"Builds"| RwSDK
    Compiler -->|"Builds"| IniR
    Compiler -->|"Builds"| HookLib
    Compiler -->|"Builds"| InjLib
    Compiler -->|"Builds"| Helper1
    Compiler -->|"Builds"| Helper2
    Compiler -->|"Builds"| Helper3
    Compiler -->|"Builds"| Helper4
    Compiler -->|"Builds"| Helper5
    Compiler -->|"Builds"| Helper6
    Compiler -->|"Produces DLLs"| IIIDLL
    Compiler --> IIISL_Cpp
    Compiler --> IIISL_H
    Compiler --> IVDLL
    Compiler --> SADLL
    Compiler --> SASL_Cpp
    Compiler --> SASL_H
    Compiler --> VCDLL
    Compiler --> VCSL_Cpp
    Compiler --> VCSL_H
    Compiler -->|"Produces EXE"| DG_SRC

    %% DataGrabber Flow
    DG_SRC -->|"Uses"| Z7
    DG_SRC -->|"Extracts Archives"| ARCH
    DG_SRC -->|"Outputs Data"| IIIDATA
    DG_SRC --> IVDATA
    DG_SRC --> SADATA
    DG_SRC --> VCDATA

    %% Runtime Connections
    GTAEXE -->|"Loaded by"| Injector
    Injector -->|"Injects"| PluginDLL
    PluginDLL -->|"Patches Calls via"| Hooking
    Hooking -->|"Uses"| RwRuntime
    PluginDLL -->|"Loads Config via"| IniR
    PluginDLL --> IIIDATA
    PluginDLL --> IVDATA
    PluginDLL --> SADATA
    PluginDLL --> VCDATA
    PluginDLL --> RwRuntime
    RwRuntime --> GPU

    %% Click Events
    click PMLUA "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//premake5.lua"
    click PMBAT "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//premake5.bat"
    click PMEXE "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//premake5.exe"
    click AVY "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//appveyor.yml"
    click GHA "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//.github/workflows/main.yml"
    click RwSDK "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//includes/rwsdk/"
    click IniR "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//external/IniReader/"
    click HookLib "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//external/hooking/"
    click InjLib "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//external/injector/"
    click Helper1 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//includes/CLODLightManager.cpp"
    click Helper2 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//includes/CLODLightManager.h"
    click Helper3 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//includes/CLODLights.cpp"
    click Helper4 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//includes/CLODLights.h"
    click Helper5 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//includes/Sprite.cpp"
    click Helper6 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//includes/Sprite.h"
    click IIIDLL "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/IIILodLights/dllmain.cpp"
    click IIISL_Cpp "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/IIILodLights/CSearchlights.cpp"
    click IIISL_H "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/IIILodLights/CSearchlights.h"
    click IVDLL "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/IVLodLights/dllmain.cpp"
    click SADLL "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/SALodLights/dllmain.cpp"
    click SASL_Cpp "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/SALodLights/CSearchlights.cpp"
    click SASL_H "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/SALodLights/CSearchlights.h"
    click VCDLL "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/VCLodLights/dllmain.cpp"
    click VCSL_Cpp "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/VCLodLights/CSearchlights.cpp"
    click VCSL_H "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/VCLodLights/CSearchlights.h"
    click DG_SRC "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//source/2DFXDataGrabber/2DFXDataGrabber.cpp"
    click DG_BIN "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//data/2DFXDataGrabber/SA2dfx.exe"
    click IIIDATA "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//data/IIILodLights/"
    click IVDATA "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//data/IVLodLights/"
    click SADATA "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//data/SALodLights/"
    click VCDATA "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/tree/master//data/VCLodLights/"
    click ARCH "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//data/2DFXDataGrabber/*.7z, *.zip"
    click Z7 "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//data/7za.exe"
    click VersionH "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//resources/VersionInfo.h"
    click VersionRC "https://github.com/thirteenag/iii.vc.sa.iv.project2dfx/blob/master//resources/VersionInfo.rc"

    %% Styles
    classDef build fill:#D6E9F8,stroke:#31708F,color:#31708F;
    classDef runtime fill:#DFF0D8,stroke:#3C763D,color:#3C763D;
    classDef data fill:#FCF8E3,stroke:#8A6D3B,color:#8A6D3B;
    classDef ext fill:#F2DEDE,stroke:#A94442,color:#A94442,stroke-dasharray: 5 5;
    class Compiler build
    class GTAEXE runtime
    class PluginDLL runtime
    class RwRuntime ext
    class GPU runtime
```
