# recol/dlss-updater architecture

> Architecture diagram of the GitHub repository recol/dlss-updater, 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/recol/dlss-updater
- Repository: https://github.com/recol/dlss-updater

## Overview

##### Main Components
- User Interface: The GUI of the application is implemented in the “dlss_updater/main_ui” directory and is built with PyQt6. This component is the primary interaction point for users.
- Business Logic and Updater: Modules such as “auto_updater.py”, “updater.py”, and “scanner.py” are central to the functionality. These handle updating the DLLs, scanning for game installations, and interacting with the configuration.
- Configuration/Constants: Files like “config.py” and “constants.py” are used to set up runtime parameters and manage paths/settings.
- Logging and Utilities: The “logger.py” and “utils.py” modules capture operational details and offer auxiliary functions.
- Threading Support: The “dlss_updater/lib/threading_lib.py” module suggests that some operations execute in parallel (for instance, scanning or updating tasks).
- External Dependencies: Included libraries (such as PyQt6, pefile, psutil, and others provided via _internal packaging) represent third-party components. Also note that hooks (in the “hooks” directory) exist to support packaging with PyInstaller.
- Packaging and Deployment: The “dist” directory contains the built executable along with an embedded copy of required libraries and a special internal structure. Additional deployment support files are present (such as the Chocolatey scripts in “tools”).

##### Relationships and Interactions
- The GUI layer sends events (such as “start scan,” “initiate update,” etc.) to the core application logic.
- The updater and scanner components communicate with the file system to detect game installations and update DLLs.
- The configuration module supplies runtime variables for both the updater and the scanner.
- The logging module is used throughout the system to record events and actions.
- The threading library is used to decouple long-running tasks (like scanning directories or updating files) from the UI, ensuring responsiveness.
- The application fetches the up-to-date blacklist (or whitelist hosted externally) and integrates this data to determine which games should be skipped.
- Build and packaging components (PyInstaller spec file and hooks) wrap these modules with internal dependencies into a distributable application.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The application cleanly separates the UI (main_ui) from the core business logic (updater, scanner, config, and utilities).
- Modularization: The code is compartmentalized into logically separate modules (configuration, logging, updater, and threading support).
- Event-Driven Design: The GUI (using PyQt6) is built on an event-driven paradigm where user events trigger processes in the updater and scanner modules.
- Packaging for Distribution: The project uses PyInstaller, with proper hooks, to collect dependencies into a standalone executable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    UI["User Interface (PyQt6 GUI)"]:::ui

    subgraph "Core Application Logic"
        direction TB
        UPD["Updater Module"]:::core
        SCN["Scanner Module"]:::core
        CFG["Configuration & Constants"]:::core
        LOG["Logging & Utilities"]:::core
        THR["Threading Support"]:::core
    end

    EGL["External Game Launchers"]:::external
    EBL["External Blacklist Repository"]:::external
    EXT["External Dependencies (PyQt6, pefile, psutil)"]:::external
    DEP["Packaging & Deployment (PyInstaller, Chocolatey, etc)"]:::deploy

    %% Relationships
    UI -->|"triggers"| UPD
    UI -->|"triggers"| SCN
    UPD -->|"configured_by"| CFG
    SCN -->|"configured_by"| CFG
    UPD -->|"logs_using"| LOG
    SCN -->|"logs_using"| LOG
    UPD -->|"async_supported_by"| THR
    SCN -->|"async_supported_by"| THR
    SCN -->|"scans"| EGL
    SCN -->|"fetchesCSV_from"| EBL
    UI ---|"built_on"| EXT
    EXT ---|"embedded_in"| DEP

    %% Packaging arrows from Core Components to Deployment
    UI -->|"packaged_by"| DEP
    UPD -->|"packaged_by"| DEP
    SCN -->|"packaged_by"| DEP
    CFG -->|"packaged_by"| DEP
    LOG -->|"packaged_by"| DEP
    THR -->|"packaged_by"| DEP

    %% Click Events
    click UI "https://github.com/recol/dlss-updater/tree/main/dlss_updater/main_ui"
    click UI "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/main_ui/main_window.py"

    click UPD "https://github.com/recol/dlss-updater/blob/main/dlss_updater/updater.py"
    click UPD "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/updater.py"

    click SCN "https://github.com/recol/dlss-updater/blob/main/dlss_updater/scanner.py"
    click SCN "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/scanner.py"

    click CFG "https://github.com/recol/dlss-updater/blob/main/dlss_updater/config.py"
    click CFG "https://github.com/recol/dlss-updater/blob/main/dlss_updater/constants.py"
    click CFG "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/config.py"
    click CFG "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/constants.py"

    click LOG "https://github.com/recol/dlss-updater/blob/main/dlss_updater/logger.py"
    click LOG "https://github.com/recol/dlss-updater/blob/main/dlss_updater/utils.py"
    click LOG "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/logger.py"
    click LOG "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/utils.py"

    click THR "https://github.com/recol/dlss-updater/blob/main/dlss_updater/lib/threading_lib.py"
    click THR "https://github.com/recol/dlss-updater/blob/main/dist/DLSS_Updater/_internal/dlss_updater/lib/threading_lib.py"

    click EXT "https://github.com/recol/dlss-updater/blob/main/hooks/hook-dlss_updater.py"
    click EXT "https://github.com/recol/dlss-updater/blob/main/hooks/hook-pefile.py"
    click EXT "https://github.com/recol/dlss-updater/blob/main/hooks/hook-psutil.py"

    click DEP "https://github.com/recol/dlss-updater/blob/main/DLSS_Updater.spec"
    click DEP "https://github.com/recol/dlss-updater/tree/main/dist"
    click DEP "https://github.com/recol/dlss-updater/tree/main/tools"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef deploy fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
