# z1ni/xgp-save-extractor architecture

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

- Interactive diagram: https://gitdiagram.com/z1ni/xgp-save-extractor
- Repository: https://github.com/z1ni/xgp-save-extractor

## Overview

##### Main Components
- Main Script (main.py): The entry point that orchestrates the extraction process.
- Game Configuration (games.json): Contains the listing or parameters for supported games.
- File I/O Subsystem: Represents the mechanism that reads save files from disk and writes out ZIP files.
- External Services & Inputs/Outputs:
– Cloud Sync/Operating System: The project interacts with the Xbox cloud save sync and local file system.
– PyInstaller Build Pipeline: Highlight the build/deployment process that generates a one-file executable using PyInstaller (indicated by the GitHub Actions workflow in .github/workflows/pyinstaller.yml).

##### Relationships and Interactions
- A side pathway showing that the project’s CI/CD (GitHub Actions workflow with PyInstaller) builds the executable, bundling Python interpreter and scripts.

##### Architectural Patterns & Design Principles
- Although the project is relatively simple, you might conceptually label it with a “procedural flow” design. Emphasize the clear separation between configuration, core logic (extraction), and deployment/build steps.
- That the design leverages external tools (PyInstaller) and standard Python modules for file compression and I/O.
- Use of external resources/integrations (e.g., PCGamingWiki for save file location references, and cloud sync behavior via Xbox Game Pass).

##### What
- Clear labels for every component that you have identified (Main Script, Game Configuration, Save Extraction Logic, File I/O, External Services, CI/CD Pipeline).
- Annotations that briefly describe the purpose of each module/component (for instance, “Main Script: orchestrates the extraction of game saves”, “PyInstaller: wraps the project into a standalone executable”, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime Flow Subgraph
    subgraph "Runtime Flow"
        U("User"):::user
        M("Main Script"):::core
        G("Game Configuration"):::config
        S("Save Extraction Module"):::core
        F("File I/O Subsystem"):::core
        E("External File System/Cloud Storage"):::external
    end

    %% CI/CD Pipeline Subgraph
    subgraph "Deployment Pipeline"
        C("CI/CD Pipeline (PyInstaller)"):::deploy
    end

    %% Connections in Runtime Flow
    U -->|"initiates"| M
    M -->|"loads"| G
    M -->|"executes"| S
    S -->|"processes via"| F
    F -->|"reads/writes to"| E
    M -->|"bundled by"| C

    %% Click Events
    click M "https://github.com/z1ni/xgp-save-extractor/blob/main/main.py"
    click G "https://github.com/z1ni/xgp-save-extractor/blob/main/games.json"
    click S "https://github.com/z1ni/xgp-save-extractor/blob/main/main.py"
    click F "https://github.com/z1ni/xgp-save-extractor/blob/main/main.py"
    click C "https://github.com/z1ni/xgp-save-extractor/blob/main/.github/workflows/pyinstaller.yml"

    %% Styles
    classDef user fill:#c8e6c9,stroke:#388e3c,stroke-width:2px;
    classDef core fill:#c5cae9,stroke:#303f9f,stroke-width:2px;
    classDef config fill:#ffecb3,stroke:#ff9800,stroke-width:2px;
    classDef external fill:#ffe082,stroke:#f9a825,stroke-width:2px;
    classDef deploy fill:#ef9a9a,stroke:#e53935,stroke-width:2px;
```
