# xortroll/goldleaf architecture

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

- Interactive diagram: https://gitdiagram.com/xortroll/goldleaf
- Repository: https://github.com/xortroll/goldleaf

## Overview

Goldleaf is a Nintendo Switch homebrew utility; its central user workflow is navigating mounted filesystems and performing file/content operations, including NSP installation and remote-PC browsing through Quark. It also provides title, ticket, account, Amiibo, settings, firmware-update, and web-browser features. Quark is the companion desktop app: it connects over USB and serves filesystem commands to Goldleaf. Source excerpts are limited, so edges between Goldleaf UI and domain handlers are documented capability links rather than verified call sites.

Main entry points: [`Goldleaf/source/ui/ui_MainApplication.cpp`](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_MainApplication.cpp) (Goldleaf app), [`Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java`](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java) (Quark UI), [`Goldleaf/source/ui/ui_BrowserLayout.cpp`](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_BrowserLayout.cpp) (Filesystem explorer), [`Goldleaf/source/ui/ui_ApplicationListLayout.cpp`](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_ApplicationListLayout.cpp) (Title browser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_switch_ui["Goldleaf UI"]
  node_goldleaf_app["Goldleaf app"]
  node_file_explorer["Filesystem explorer"]
  node_content_browser["Title browser"]
  node_tickets["Ticket browser"]
  node_accounts["Account manager"]
  node_amiibo["Amiibo dump"]
  node_settings["Settings"]
  node_web["Web browser"]
end

subgraph group_switch_domain["Switch features"]
  node_explorer_backend["Explorer backends"]
  node_file_ops["File operations<br/>[fs_Explorer.cpp]"]
  node_fatfs["FAT filesystem<br/>[ff.c]"]
  node_content_service["Title content<br/>[cnt_Content.cpp]"]
  node_installer["NSP installer<br/>[nsp_Installer.cpp]"]
  node_exporter["Content export<br/>[expt_Export.cpp]"]
  node_updates["Firmware updates<br/>[upd_Update.cpp]"]
end

subgraph group_host_app["Quark desktop"]
  node_quark_main["Quark launcher<br/>[Main.java]"]
  node_quark_ui["Quark UI"]
  node_quark_controller["UI controller"]
  node_host_fs["Host filesystem<br/>[FileSystem.java]"]
end

subgraph group_host_protocol["Quark protocol"]
  node_usb_interface["USB interface<br/>[USBInterface.java]"]
  node_command_framework["Command handlers"]
  node_command_block["USB command block<br/>[CommandBlock.java]"]
  node_command_handler["Handler interface"]
  node_command["Command definition<br/>[Command.java]"]
  node_buffer["Protocol buffer<br/>[Buffer.java]"]
end

node_user(("Console user"))
node_pc_user(("PC user"))
node_host_storage[("PC filesystem")]
node_switch_console(("Nintendo Switch"))

node_user -->|"uses"| node_goldleaf_app
node_goldleaf_app -->|"opens"| node_file_explorer
node_file_explorer -->|"browses mounts"| node_explorer_backend
node_file_explorer -->|"performs operations"| node_file_ops
node_explorer_backend -.->|"uses FAT support"| node_fatfs
node_goldleaf_app -->|"opens"| node_content_browser
node_content_browser -->|"manages titles"| node_content_service
node_content_browser -->|"installs NSPs"| node_installer
node_content_browser -->|"exports content"| node_exporter
node_goldleaf_app -->|"opens"| node_tickets
node_goldleaf_app -->|"opens"| node_accounts
node_goldleaf_app -->|"opens"| node_amiibo
node_goldleaf_app -->|"opens"| node_settings
node_settings -->|"checks updates"| node_updates
node_goldleaf_app -->|"opens"| node_web
node_pc_user -->|"launches"| node_quark_main
node_quark_main -->|"runs"| node_quark_ui
node_quark_ui -->|"connects over USB"| node_usb_interface
node_quark_ui -->|"starts USB task"| node_command_framework
node_quark_ui -->|"loads UI controller"| node_quark_controller
node_quark_controller -->|"updates UI config"| node_quark_ui
node_command_framework -->|"handles blocks"| node_command_block
node_command_framework -->|"queries filesystem"| node_host_fs
node_command_framework -->|"registers commands"| node_command
node_command -->|"dispatches to"| node_command_handler
node_command_block -->|"reads and writes"| node_usb_interface
node_command_block -->|"encodes data"| node_buffer
node_host_fs -->|"reads and writes"| node_host_storage
node_switch_console -.->|"connects to Quark"| node_usb_interface
node_file_explorer -->|"browses remote PC"| node_switch_console

click node_goldleaf_app "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_MainApplication.cpp"
click node_file_explorer "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_BrowserLayout.cpp"
click node_explorer_backend "https://github.com/xortroll/goldleaf/tree/master/Goldleaf/source/fs"
click node_file_ops "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/fs/fs_Explorer.cpp"
click node_fatfs "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/fatfs/ff.c"
click node_content_browser "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_ApplicationListLayout.cpp"
click node_content_service "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/cnt/cnt_Content.cpp"
click node_installer "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/nsp/nsp_Installer.cpp"
click node_exporter "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/expt/expt_Export.cpp"
click node_tickets "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_TicketsLayout.cpp"
click node_accounts "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_AccountLayout.cpp"
click node_amiibo "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_AmiiboDumpLayout.cpp"
click node_settings "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_SettingsLayout.cpp"
click node_updates "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/upd/upd_Update.cpp"
click node_web "https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_WebBrowserLayout.cpp"
click node_quark_main "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/Main.java"
click node_quark_ui "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java"
click node_quark_controller "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/ui/MainController.java"
click node_host_fs "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/fs/FileSystem.java"
click node_usb_interface "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/USBInterface.java"
click node_command_framework "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandFramework.java"
click node_command_block "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cmd/CommandBlock.java"
click node_command_handler "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandHandler.java"
click node_command "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/Command.java"
click node_buffer "https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/Buffer.java"

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_goldleaf_app,node_file_explorer,node_content_browser,node_tickets,node_accounts,node_amiibo,node_settings,node_web,node_user,node_pc_user toneBlue
class node_explorer_backend,node_file_ops,node_fatfs,node_content_service,node_installer,node_exporter,node_updates,node_host_storage toneAmber
class node_quark_main,node_quark_ui,node_quark_controller,node_host_fs toneMint
class node_usb_interface,node_command_framework,node_command_block,node_command_handler,node_command,node_buffer toneRose
class node_switch_console toneIndigo
```

## Components

### Goldleaf UI

- [Goldleaf app](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_MainApplication.cpp): `Goldleaf/source/ui/ui_MainApplication.cpp`
- [Filesystem explorer](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_BrowserLayout.cpp): `Goldleaf/source/ui/ui_BrowserLayout.cpp`
- [Title browser](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_ApplicationListLayout.cpp): `Goldleaf/source/ui/ui_ApplicationListLayout.cpp`
- [Ticket browser](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_TicketsLayout.cpp): `Goldleaf/source/ui/ui_TicketsLayout.cpp`
- [Account manager](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_AccountLayout.cpp): `Goldleaf/source/ui/ui_AccountLayout.cpp`
- [Amiibo dump](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_AmiiboDumpLayout.cpp): `Goldleaf/source/ui/ui_AmiiboDumpLayout.cpp`
- [Settings](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_SettingsLayout.cpp): `Goldleaf/source/ui/ui_SettingsLayout.cpp`
- [Web browser](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/ui/ui_WebBrowserLayout.cpp): `Goldleaf/source/ui/ui_WebBrowserLayout.cpp`

### Switch features

- [Explorer backends](https://github.com/xortroll/goldleaf/tree/master/Goldleaf/source/fs): `Goldleaf/source/fs`
- [File operations](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/fs/fs_Explorer.cpp): `Goldleaf/source/fs/fs_Explorer.cpp`
- [FAT filesystem](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/fatfs/ff.c): `Goldleaf/source/fatfs/ff.c`
- [Title content](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/cnt/cnt_Content.cpp): `Goldleaf/source/cnt/cnt_Content.cpp`
- [NSP installer](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/nsp/nsp_Installer.cpp): `Goldleaf/source/nsp/nsp_Installer.cpp`
- [Content export](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/expt/expt_Export.cpp): `Goldleaf/source/expt/expt_Export.cpp`
- [Firmware updates](https://github.com/xortroll/goldleaf/blob/master/Goldleaf/source/upd/upd_Update.cpp): `Goldleaf/source/upd/upd_Update.cpp`

### Quark desktop

- [Quark launcher](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/Main.java): `Quark/src/main/java/xortroll/goldleaf/quark/Main.java`
- [Quark UI](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java): `Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java`
- [UI controller](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/ui/MainController.java): `Quark/src/main/java/xortroll/goldleaf/quark/ui/MainController.java`
- [Host filesystem](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/fs/FileSystem.java): `Quark/src/main/java/xortroll/goldleaf/quark/fs/FileSystem.java`

### Quark protocol

- [USB interface](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/USBInterface.java): `Quark/src/main/java/xortroll/goldleaf/quark/usb/USBInterface.java`
- [Command handlers](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandFramework.java): `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandFramework.java`
- [USB command block](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cmd/CommandBlock.java): `Quark/src/main/java/xortroll/goldleaf/quark/usb/cmd/CommandBlock.java`
- [Handler interface](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandHandler.java): `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandHandler.java`
- [Command definition](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/Command.java): `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/Command.java`
- [Protocol buffer](https://github.com/xortroll/goldleaf/blob/master/Quark/src/main/java/xortroll/goldleaf/quark/Buffer.java): `Quark/src/main/java/xortroll/goldleaf/quark/Buffer.java`

### Other components

- **Console user**
- **PC user**
- **PC filesystem**
- **Nintendo Switch**

## Connections

- Console user → Goldleaf app: uses (evidence: `README.md`)
- Goldleaf app → Filesystem explorer: opens (evidence: `README.md`)
- Filesystem explorer → Explorer backends: browses mounts (evidence: `README.md`)
- Filesystem explorer → File operations: performs operations (evidence: `README.md`)
- Explorer backends → FAT filesystem: uses FAT support
- Goldleaf app → Title browser: opens (evidence: `README.md`)
- Title browser → Title content: manages titles (evidence: `README.md`)
- Title browser → NSP installer: installs NSPs (evidence: `README.md`)
- Title browser → Content export: exports content (evidence: `README.md`)
- Goldleaf app → Ticket browser: opens (evidence: `README.md`)
- Goldleaf app → Account manager: opens (evidence: `README.md`)
- Goldleaf app → Amiibo dump: opens (evidence: `README.md`)
- Goldleaf app → Settings: opens (evidence: `README.md`)
- Settings → Firmware updates: checks updates (evidence: `README.md`)
- Goldleaf app → Web browser: opens (evidence: `README.md`)
- PC user → Quark launcher: launches (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/Main.java`)
- Quark launcher → Quark UI: runs (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/Main.java`)
- Quark UI → USB interface: connects over USB (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java`)
- Quark UI → Command handlers: starts USB task (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java`)
- Quark UI → UI controller: loads UI controller (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/ui/MainApplication.java`)
- UI controller → Quark UI: updates UI config (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/ui/MainController.java`)
- Command handlers → USB command block: handles blocks (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandFramework.java`)
- Command handlers → Host filesystem: queries filesystem (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandFramework.java`)
- Command handlers → Command definition: registers commands (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandFramework.java`)
- Command definition → Handler interface: dispatches to (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/usb/cf/CommandHandler.java`)
- USB command block → USB interface: reads and writes (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/usb/cmd/CommandBlock.java`)
- USB command block → Protocol buffer: encodes data (evidence: `Quark/src/main/java/xortroll/goldleaf/quark/usb/cmd/CommandBlock.java`)
- Host filesystem → PC filesystem: reads and writes
- Nintendo Switch → USB interface: connects to Quark (evidence: `README.md`)
- Filesystem explorer → Nintendo Switch: browses remote PC (evidence: `README.md`)
