# s4ammy/3dstboi architecture

> Architecture diagram of the GitHub repository s4ammy/3dstboi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/s4ammy/3dstboi
- Repository: https://github.com/s4ammy/3dstboi

## Overview

This is a desktop CIA patcher that converts a supported original Isaac CIA into a verified, Old-3DS-compatible CIA. The user supplies the CIA and, when needed, a title seed; the CLI passes options to the pipeline, which extracts and checks the input, applies game and hardware-profile changes, rebuilds the CIA, and verifies and reports the result. The README also documents lower-precision texture handling and updated controls. Pipeline excerpts show tool execution and verification; some internal calls are not shown, so those links are left unverified.

Main entry points: [`src/Pipeline.cpp`](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp) (Patch pipeline), [`src/Patches.cpp`](https://github.com/s4ammy/3dstboi/blob/main/src/Patches.cpp) (Game and profile patches), [`src/main.cpp`](https://github.com/s4ammy/3dstboi/blob/main/src/main.cpp) (CLI options), [`src/TextureData.h`](https://github.com/s4ammy/3dstboi/blob/main/src/TextureData.h) (Texture patch payload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_cli["CLI options<br/>[main.cpp]"]
end

subgraph group_processing["CIA processing"]
  node_pipeline["Patch pipeline<br/>[Pipeline.cpp]"]
  node_cia_inspection["CIA inspection<br/>[Pipeline.cpp]"]
  node_extract["CIA extraction<br/>[Pipeline.cpp]"]
  node_bytes["Binary and hash helpers<br/>[Bytes.cpp]"]
end

subgraph group_patching["Game adaptations"]
  node_patch_engine["Game and profile patches<br/>[Patches.cpp]"]
  node_texture_payload["Texture patch payload<br/>[TextureData.h]"]
  node_texture_runtime["Texture conversion routines<br/>[Texture16.cpp]"]
end

subgraph group_delivery["Rebuild and verification"]
  node_rebuild_profile["Rebuild profile<br/>[RebuildData.h]"]
  node_rebuild["CIA rebuild<br/>[Pipeline.cpp]"]
  node_verification["Output verification<br/>[Pipeline.cpp]"]
  node_report["CIA and report files<br/>[Pipeline.cpp]"]
end

node_user(("Patcher user"))
node_ctrtool["ctrtool"]
node_makerom["makerom"]

node_user -->|"provides inputs"| node_cli
node_cli -->|"runs"| node_pipeline
node_pipeline -->|"inspects"| node_cia_inspection
node_pipeline -->|"extracts"| node_extract
node_extract -->|"runs"| node_ctrtool
node_pipeline -.->|"applies patches"| node_patch_engine
node_patch_engine -->|"uses payload"| node_texture_payload
node_patch_engine -.->|"includes texture changes"| node_texture_runtime
node_pipeline -->|"uses settings"| node_rebuild_profile
node_pipeline -->|"rebuilds CIA"| node_rebuild
node_rebuild -->|"runs"| node_makerom
node_pipeline -->|"verifies output"| node_verification
node_verification -->|"re-extracts with"| node_ctrtool
node_pipeline -->|"writes result"| node_report

click node_cli "https://github.com/s4ammy/3dstboi/blob/main/src/main.cpp"
click node_pipeline "https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp"
click node_cia_inspection "https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp"
click node_extract "https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp"
click node_bytes "https://github.com/s4ammy/3dstboi/blob/main/src/Bytes.cpp"
click node_patch_engine "https://github.com/s4ammy/3dstboi/blob/main/src/Patches.cpp"
click node_texture_payload "https://github.com/s4ammy/3dstboi/blob/main/src/TextureData.h"
click node_texture_runtime "https://github.com/s4ammy/3dstboi/blob/main/patches/Texture16.cpp"
click node_rebuild_profile "https://github.com/s4ammy/3dstboi/blob/main/src/RebuildData.h"
click node_rebuild "https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp"
click node_verification "https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp"
click node_report "https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp"

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_cli,node_user toneBlue
class node_pipeline,node_cia_inspection,node_extract,node_bytes toneAmber
class node_patch_engine,node_texture_payload,node_texture_runtime toneMint
class node_rebuild_profile,node_rebuild,node_verification,node_report toneRose
class node_ctrtool,node_makerom toneIndigo
```

## Components

### User entry

- [CLI options](https://github.com/s4ammy/3dstboi/blob/main/src/main.cpp): `src/main.cpp`

### CIA processing

- [Patch pipeline](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp): `src/Pipeline.cpp`
- [CIA inspection](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp): `src/Pipeline.cpp`
- [CIA extraction](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp): `src/Pipeline.cpp`
- [Binary and hash helpers](https://github.com/s4ammy/3dstboi/blob/main/src/Bytes.cpp): `src/Bytes.cpp`

### Game adaptations

- [Game and profile patches](https://github.com/s4ammy/3dstboi/blob/main/src/Patches.cpp): `src/Patches.cpp`
- [Texture patch payload](https://github.com/s4ammy/3dstboi/blob/main/src/TextureData.h): `src/TextureData.h`
- [Texture conversion routines](https://github.com/s4ammy/3dstboi/blob/main/patches/Texture16.cpp): `patches/Texture16.cpp`

### Rebuild and verification

- [Rebuild profile](https://github.com/s4ammy/3dstboi/blob/main/src/RebuildData.h): `src/RebuildData.h`
- [CIA rebuild](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp): `src/Pipeline.cpp`
- [Output verification](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp): `src/Pipeline.cpp`
- [CIA and report files](https://github.com/s4ammy/3dstboi/blob/main/src/Pipeline.cpp): `src/Pipeline.cpp`

### Other components

- **Patcher user**
- **ctrtool**
- **makerom**

## Connections

- Patcher user → CLI options: provides inputs (evidence: `README.md`)
- CLI options → Patch pipeline: runs (evidence: `src/main.cpp`)
- Patch pipeline → CIA inspection: inspects (evidence: `README.md`)
- Patch pipeline → CIA extraction: extracts (evidence: `src/Pipeline.cpp`)
- CIA extraction → ctrtool: runs (evidence: `src/Pipeline.cpp`)
- Patch pipeline → Game and profile patches: applies patches
- Game and profile patches → Texture patch payload: uses payload (evidence: `src/Patches.cpp`)
- Game and profile patches → Texture conversion routines: includes texture changes
- Patch pipeline → Rebuild profile: uses settings (evidence: `src/Pipeline.cpp`)
- Patch pipeline → CIA rebuild: rebuilds CIA (evidence: `README.md`)
- CIA rebuild → makerom: runs (evidence: `src/Pipeline.cpp`)
- Patch pipeline → Output verification: verifies output (evidence: `src/Pipeline.cpp`)
- Output verification → ctrtool: re-extracts with (evidence: `src/Pipeline.cpp`)
- Patch pipeline → CIA and report files: writes result (evidence: `README.md`)
