# therevealz/stellasora-metadatadecryption architecture

> Architecture diagram of the GitHub repository therevealz/stellasora-metadatadecryption, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/therevealz/stellasora-metadatadecryption
- Repository: https://github.com/therevealz/stellasora-metadatadecryption

## Overview

1. **Repository purpose**
   - This is a small native C++ command-line utility whose sole job is to decrypt Stella Sora’s `global-metadata.dat`-style file and write a decrypted copy to disk.

2. **Top-level structure**
   - The repo is intentionally minimal: one executable project (`.sln` + `.vcxproj`), one main source file (`main.cpp`), and one helper header (`decrypt_chunk.hpp`).
   - There are no app layers, services, UI, databases, or network integrations.

3. **Runtime boundary**
   - The program runs as a local desktop/CLI process.
   - Its only external inputs/outputs are filesystem paths: one encrypted metadata file in, one decrypted metadata file out.

4. **Entry point and orchestration**
   - `main.cpp` is the application entry point and likely handles:
     - command-line argument parsing,
     - input/output file validation,
     - invoking the decryption routine,
     - reporting success/failure to the console.
   - This is the orchestration layer for the whole tool.

5. **Decryption logic**
   - `decrypt_chunk.hpp` isolates the actual chunk-level decrypt logic.
   - The structure suggests the file is processed in pieces rather than as one monolithic transform, which is typical for metadata decryption workflows.
   - That header is the main algorithmic boundary in the repo.

6. **Data flow**
   - The flow is straightforward:
     - encrypted metadata file is read from disk,
     - content is passed through the decryption routine,
     - decrypted bytes are written to a new output file.
   - No intermediate persistence or cross-process communication is implied.

7. **Project/build tooling**
   - The repository uses a Visual Studio C++ solution/project (`.sln`, `.vcxproj`, `.filters`), so the primary build target is a Windows native executable.
   - The architecture is therefore centered on a single compiled binary rather than multiple packages or modules.

8. **Code organization boundary**
   - The split between `main.cpp` and `decrypt_chunk.hpp` separates “program control” from “cryptographic/byte-processing behavior.”
   - That makes the diagram simple: CLI boundary on the left, decryption engine in the middle, output file on the right.

9. **External dependency context**
   - The README credits an upstream project, indicating the decryption approach is derived from prior reverse-engineering work rather than an independent protocol implementation.
   - There are no other named third-party runtime dependencies in the repo.

10. **What to show in an architecture diagram**
   - A good diagram would have:
     - user/terminal,
     - encrypted metadata input file,
     - the `StellaSora-MetadataDecryption` executable,
     - the decryption helper module,
     - decrypted metadata output file.
   - The only meaningful boundary is between filesystem I/O and the decryption routine inside the executable.

Main entry points: [`main.cpp`](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/main.cpp) (Main), [`StellaSora-MetadataDecryption.vcxproj`](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/StellaSora-MetadataDecryption.vcxproj) (Project), [`decrypt_chunk.hpp`](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/decrypt_chunk.hpp) (Decrypt chunk), [`StellaSora-MetadataDecryption.sln`](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/StellaSora-MetadataDecryption.sln) (Solution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_user_terminal(("Terminal<br/>cli user"))
  node_input_metadata[("Encrypted file<br/>filesystem input")]
  node_output_metadata[("Decrypted file<br/>filesystem output")]
  node_exe["Tool<br/>native exe"]
end

subgraph group_source["Source"]
  node_main_cpp["Main<br/>orchestrator<br/>[main.cpp]"]
  node_decrypt_chunk_hpp["Decrypt chunk<br/>byte-processing<br/>[decrypt_chunk.hpp]"]
end

subgraph group_build["Build"]
  node_solution["Solution"]
  node_project["Project<br/>vcxproj"]
end

node_user_terminal -->|"launches"| node_exe
node_user_terminal -->|"selects"| node_input_metadata
node_exe -->|"starts at"| node_main_cpp
node_main_cpp -->|"reads"| node_input_metadata
node_main_cpp -->|"invokes"| node_decrypt_chunk_hpp
node_decrypt_chunk_hpp -->|"produces bytes for"| node_output_metadata
node_main_cpp -->|"writes"| node_output_metadata
node_main_cpp -->|"reports"| node_exe
node_solution -->|"includes"| node_project
node_project -->|"builds"| node_main_cpp
node_project -->|"builds"| node_decrypt_chunk_hpp

click node_main_cpp "https://github.com/therevealz/stellasora-metadatadecryption/blob/main/main.cpp"
click node_decrypt_chunk_hpp "https://github.com/therevealz/stellasora-metadatadecryption/blob/main/decrypt_chunk.hpp"
click node_solution "https://github.com/therevealz/stellasora-metadatadecryption/blob/main/StellaSora-MetadataDecryption.sln"
click node_project "https://github.com/therevealz/stellasora-metadatadecryption/blob/main/StellaSora-MetadataDecryption.vcxproj"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user_terminal,node_input_metadata,node_output_metadata,node_exe toneBlue
class node_main_cpp,node_decrypt_chunk_hpp toneAmber
class node_solution,node_project toneMint
```

## Components

### Runtime

Local CLI execution boundary and file I/O

- **Terminal**: cli user · Runs the tool and provides file paths
- **Encrypted file**: filesystem input · Stella Sora metadata file to decrypt
- **Decrypted file**: filesystem output · Written decrypted metadata copy
- **Tool**: native exe · Single Windows command-line executable

### Source

Program entry point and decryption logic

- [Main](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/main.cpp): orchestrator · Parses arguments, validates paths, drives the decrypt flow · `main.cpp`
- [Decrypt chunk](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/decrypt_chunk.hpp): byte-processing · Chunk-level metadata decryption routine · `decrypt_chunk.hpp`

### Build

Visual Studio project and solution

- [Solution](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/StellaSora-MetadataDecryption.sln): vs solution · Visual Studio entry for the native executable · `StellaSora-MetadataDecryption.sln`
- [Project](https://github.com/therevealz/stellasora-metadatadecryption/blob/main/StellaSora-MetadataDecryption.vcxproj): vcxproj · Build target and source file wiring · `StellaSora-MetadataDecryption.vcxproj`

## Connections

- Terminal → Tool: launches · User starts the command-line utility
- Terminal → Encrypted file: selects · User supplies the encrypted metadata path
- Tool → Main: starts at · Executable enters through main.cpp
- Main → Encrypted file: reads · Validates and opens the encrypted source file
- Main → Decrypt chunk: invokes · Delegates byte processing to the chunk decrypt routine
- Decrypt chunk → Decrypted file: produces bytes for · Decrypted content is assembled for output
- Main → Decrypted file: writes · Saves the decrypted metadata file to disk
- Main → Tool: reports · Prints success or failure status to the console
- Solution → Project: includes · Solution contains the C++ project
- Project → Main: builds · Project compiles the entry point
- Project → Decrypt chunk: builds · Project includes the decryption helper header
