# ghost0159/ghost-eshop-homebrew architecture

> Architecture diagram of the GitHub repository ghost0159/ghost-eshop-homebrew, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghost0159/ghost-eshop-homebrew
- Repository: https://github.com/ghost0159/ghost-eshop-homebrew

## Overview

Ghost eShop is a Nintendo 3DS storefront for browsing and downloading digital products. The principal flow starts in the main screen, loads/selects a store, presents searchable and sortable catalog entries, then queues/downloads and installs a selected product. Settings, themes, language, QR handling, and argument-driven scripted actions are additional capabilities. The tree and excerpts support the main-screen/store-loading and argument-parser links; detailed wiring for several catalog and installation subsystems was not sampled, so those links are omitted where ownership is uncertain.

Main entry points: [`source/store/store.cpp`](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/store/store.cpp) (Store metadata), [`source/screens/mainScreen.cpp`](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/screens/mainScreen.cpp) (Main screen), [`source/utils/config.cpp`](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/config.cpp) (User configuration), [`source/utils/download.cpp`](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/download.cpp) (Download transfer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_mainloop["Main loop<br/>[init.hpp]"]
  node_main_screen["Main screen<br/>[mainScreen.cpp]"]
end

subgraph group_catalog["Store and catalog"]
  node_store_select["Store selection<br/>[storeSelect.cpp]"]
  node_store["Store metadata<br/>[store.cpp]"]
  node_store_utils["Catalog operations<br/>[storeUtils.cpp]"]
  node_search["Search and filters<br/>[searchMenu.cpp]"]
  node_sorting["Sort and marks<br/>[sortMenu.cpp]"]
  node_queue_menu["Download queue UI<br/>[queueMenu.cpp]"]
end

subgraph group_delivery["Download and actions"]
  node_download["Download transfer<br/>[download.cpp]"]
  node_extract["Archive extraction<br/>[extract.cpp]"]
  node_cia["CIA handling<br/>[cia.cpp]"]
  node_script["Store actions<br/>[scriptUtils.cpp]"]
  node_argument["Argument actions<br/>[argumentParser.cpp]"]
  node_qr["QR decoding<br/>[decode.cpp]"]
end

subgraph group_presentation["UI and preferences"]
  node_settings["Settings UI<br/>[settings.cpp]"]
  node_config["User configuration<br/>[config.cpp]"]
  node_theme["Theme management<br/>[theme.cpp]"]
  node_language["Language resources<br/>[lang.cpp]"]
  node_gui["Screen framework<br/>[gui.cpp]"]
end

node_user(("3DS user"))
node_network(("Store and file server"))
node_sdcard[("SD card")]

node_user -->|"launches"| node_entry
node_entry -->|"starts"| node_mainloop
node_entry -->|"parses arguments"| node_argument
node_mainloop -->|"runs"| node_main_screen
node_main_screen -->|"opens store selection"| node_store_select
node_store_select -->|"loads selected store"| node_store
node_main_screen -->|"downloads store data"| node_download
node_network -->|"provides files"| node_download
node_download -->|"writes downloads"| node_sdcard
node_store -->|"reads store data"| node_sdcard
node_user -->|"searches catalog"| node_search
node_user -->|"filters and sorts"| node_sorting
node_user -->|"manages queue"| node_queue_menu
node_user -->|"changes preferences"| node_settings
node_settings -->|"updates settings"| node_config
node_config -->|"persists settings"| node_sdcard
node_config -->|"selects theme"| node_theme
node_config -->|"selects language"| node_language
node_argument -->|"loads store entry"| node_store
node_argument -->|"executes action"| node_script
node_store -->|"supplies store JSON"| node_script
node_user -.->|"scans QR content"| node_qr
node_main_screen -->|"draws interface"| node_gui
node_store_utils -->|"reads catalog entries"| node_store
node_download -->|"hands off archives"| node_extract
node_extract -->|"writes extracted files"| node_sdcard
node_cia -->|"handles install files"| node_sdcard

click node_entry "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/main.cpp"
click node_mainloop "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/include/init.hpp"
click node_main_screen "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/screens/mainScreen.cpp"
click node_store_select "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/overlays/storeSelect.cpp"
click node_store "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/store/store.cpp"
click node_store_utils "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/store/storeUtils.cpp"
click node_search "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/searchMenu.cpp"
click node_sorting "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/sortMenu.cpp"
click node_queue_menu "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/queueMenu.cpp"
click node_download "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/download.cpp"
click node_extract "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/extract.cpp"
click node_cia "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/cia.cpp"
click node_script "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/scriptUtils.cpp"
click node_argument "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/argumentParser.cpp"
click node_qr "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/qr/decode.cpp"
click node_settings "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/settings.cpp"
click node_config "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/config.cpp"
click node_theme "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/theme.cpp"
click node_language "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/lang.cpp"
click node_gui "https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/Universal-Core/gui.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_entry,node_mainloop,node_main_screen,node_user toneBlue
class node_store_select,node_store,node_store_utils,node_search,node_sorting,node_queue_menu,node_sdcard toneAmber
class node_download,node_extract,node_cia,node_script,node_argument,node_qr,node_network toneMint
class node_settings,node_config,node_theme,node_language,node_gui toneRose
```

## Components

### Application flow

- [Application entry](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/main.cpp): `source/main.cpp`
- [Main loop](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/include/init.hpp): `include/init.hpp`
- [Main screen](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/screens/mainScreen.cpp): `source/screens/mainScreen.cpp`

### Store and catalog

- [Store selection](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/overlays/storeSelect.cpp): `source/overlays/storeSelect.cpp`
- [Store metadata](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/store/store.cpp): `source/store/store.cpp`
- [Catalog operations](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/store/storeUtils.cpp): `source/store/storeUtils.cpp`
- [Search and filters](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/searchMenu.cpp): `source/menu/searchMenu.cpp`
- [Sort and marks](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/sortMenu.cpp): `source/menu/sortMenu.cpp`
- [Download queue UI](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/queueMenu.cpp): `source/menu/queueMenu.cpp`

### Download and actions

- [Download transfer](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/download.cpp): `source/utils/download.cpp`
- [Archive extraction](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/extract.cpp): `source/utils/extract.cpp`
- [CIA handling](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/cia.cpp): `source/utils/cia.cpp`
- [Store actions](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/scriptUtils.cpp): `source/utils/scriptUtils.cpp`
- [Argument actions](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/argumentParser.cpp): `source/utils/argumentParser.cpp`
- [QR decoding](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/qr/decode.cpp): `source/qr/decode.cpp`

### UI and preferences

- [Settings UI](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/menu/settings.cpp): `source/menu/settings.cpp`
- [User configuration](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/config.cpp): `source/utils/config.cpp`
- [Theme management](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/theme.cpp): `source/utils/theme.cpp`
- [Language resources](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/source/utils/lang.cpp): `source/utils/lang.cpp`
- [Screen framework](https://github.com/ghost0159/ghost-eshop-homebrew/blob/main/Universal-Core/gui.cpp): `Universal-Core/gui.cpp`

### Other components

- **3DS user**
- **Store and file server**
- **SD card**

## Connections

- 3DS user → Application entry: launches
- Application entry → Main loop: starts
- Application entry → Argument actions: parses arguments
- Main loop → Main screen: runs
- Main screen → Store selection: opens store selection
- Store selection → Store metadata: loads selected store
- Main screen → Download transfer: downloads store data
- Store and file server → Download transfer: provides files
- Download transfer → SD card: writes downloads
- Store metadata → SD card: reads store data
- 3DS user → Search and filters: searches catalog
- 3DS user → Sort and marks: filters and sorts
- 3DS user → Download queue UI: manages queue
- 3DS user → Settings UI: changes preferences
- Settings UI → User configuration: updates settings
- User configuration → SD card: persists settings
- User configuration → Theme management: selects theme
- User configuration → Language resources: selects language
- Argument actions → Store metadata: loads store entry
- Argument actions → Store actions: executes action
- Store metadata → Store actions: supplies store JSON
- 3DS user → QR decoding: scans QR content
- Main screen → Screen framework: draws interface
- Catalog operations → Store metadata: reads catalog entries
- Download transfer → Archive extraction: hands off archives
- Archive extraction → SD card: writes extracted files
- CIA handling → SD card: handles install files
