# ilyashdev/mediaboy architecture

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

- Interactive diagram: https://gitdiagram.com/ilyashdev/mediaboy
- Repository: https://github.com/ilyashdev/mediaboy

## Overview

MediaBoy is a desktop and command-line converter that turns images, galleries, GIFs, videos, and music into Game Boy ROMs. The main workflow is selecting a mode and source, adjusting conversion settings, encoding/exporting assets, compiling with GBDK, and writing ROM output. Distinct branches handle image processing, GBVP3 video and audio, and playlist/chiptune music; dependency discovery and installation support the conversion tools. Edges follow the excerpts and README; unsampled subsystem links are omitted or marked unverified.

Main entry points: [`src/internal/cli/commands.go`](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/cli/commands.go) (CLI commands), [`src/internal/music/export.go`](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/export.go) (Music ROM export), [`src/internal/gbdk/compiler.go`](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/compiler.go) (GBDK compiler), [`src/internal/ui/app.go`](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/ui/app.go) (Desktop UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_main["App entrypoint<br/>[main.go]"]
  node_cli["CLI commands<br/>[commands.go]"]
  node_ui["Desktop UI<br/>[app.go]"]
end

subgraph group_image["Image ROMs"]
  node_imaging["Image conversion<br/>[pipeline.go]"]
  node_image_export["Image ROM export<br/>[encoder.go]"]
  node_gallery["Gallery export<br/>[gallery.go]"]
  node_printer["Printer support<br/>[gbprinter.c]"]
end

subgraph group_video["Video ROMs"]
  node_video_import["Video import<br/>[import.go]"]
  node_video_encode["GBVP3 encoding<br/>[gbvp3enc.go]"]
  node_video_fit["Video fitting<br/>[fit.go]"]
  node_video_rom["Video ROM export<br/>[rom.go]"]
end

subgraph group_music["Music ROMs"]
  node_music_export["Music ROM export<br/>[export.go]"]
  node_pcm["PCM encoding<br/>[pcm.go]"]
  node_chiptune["Chiptune encoding<br/>[chiptune.go]"]
end

subgraph group_support["Tool support"]
  node_ffmpeg["FFmpeg wrapper<br/>[ffmpeg.go]"]
  node_gbdk["GBDK compiler<br/>[compiler.go]"]
  node_deps["Dependency manager<br/>[deps.go]"]
end

node_user(("User"))
node_tools["GBDK and FFmpeg"]
node_rom["ROM output"]

node_user -->|"starts"| node_main
node_main -->|"dispatches"| node_cli
node_main -->|"opens"| node_ui
node_user -->|"runs conversion"| node_cli
node_user -->|"selects mode"| node_ui
node_ui -->|"previews image"| node_imaging
node_cli -->|"converts image"| node_imaging
node_imaging -.->|"prepares assets"| node_image_export
node_cli -->|"exports gallery"| node_gallery
node_image_export -->|"embeds printer support"| node_printer
node_cli -->|"loads clip"| node_video_import
node_video_import -.->|"uses FFmpeg"| node_ffmpeg
node_cli -->|"encodes clip"| node_video_encode
node_cli -->|"fits clip"| node_video_fit
node_video_encode -.->|"writes video ROM"| node_video_rom
node_cli -->|"exports playlist"| node_music_export
node_music_export -->|"encodes PCM"| node_pcm
node_music_export -->|"encodes chiptune"| node_chiptune
node_music_export -->|"probes audio"| node_ffmpeg
node_image_export -.->|"compiles ROM"| node_gbdk
node_video_rom -.->|"compiles ROM"| node_gbdk
node_music_export -.->|"compiles ROM"| node_gbdk
node_gbdk -.->|"invokes toolchain"| node_tools
node_ui -->|"checks dependencies"| node_deps
node_deps -->|"installs tools"| node_tools
node_gbdk -.->|"writes output"| node_rom
node_video_rom -->|"writes output"| node_rom
node_music_export -->|"writes output"| node_rom

click node_main "https://github.com/ilyashdev/mediaboy/blob/master/src/main.go"
click node_cli "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/cli/commands.go"
click node_ui "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/ui/app.go"
click node_imaging "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/imaging/pipeline.go"
click node_image_export "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/encoder.go"
click node_gallery "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/gallery.go"
click node_printer "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/gbdklib/gbprinter.c"
click node_video_import "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/import.go"
click node_video_encode "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/gbvp3enc.go"
click node_video_fit "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/fit.go"
click node_video_rom "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/rom.go"
click node_ffmpeg "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/ffmpeg/ffmpeg.go"
click node_music_export "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/export.go"
click node_pcm "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/pcm.go"
click node_chiptune "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/chiptune.go"
click node_gbdk "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/compiler.go"
click node_deps "https://github.com/ilyashdev/mediaboy/blob/master/src/internal/deps/deps.go"

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_main,node_cli,node_ui,node_user toneBlue
class node_imaging,node_image_export,node_gallery,node_printer toneAmber
class node_video_import,node_video_encode,node_video_fit,node_video_rom toneMint
class node_music_export,node_pcm,node_chiptune toneRose
class node_ffmpeg,node_gbdk,node_deps,node_tools,node_rom toneIndigo
```

## Components

### App entry

- [App entrypoint](https://github.com/ilyashdev/mediaboy/blob/master/src/main.go): `src/main.go`
- [CLI commands](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/cli/commands.go): `src/internal/cli/commands.go`
- [Desktop UI](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/ui/app.go): `src/internal/ui/app.go`

### Image ROMs

- [Image conversion](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/imaging/pipeline.go): `src/internal/imaging/pipeline.go`
- [Image ROM export](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/encoder.go): `src/internal/gbdk/encoder.go`
- [Gallery export](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/gallery.go): `src/internal/gbdk/gallery.go`
- [Printer support](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/gbdklib/gbprinter.c): `src/internal/gbdk/gbdklib/gbprinter.c`

### Video ROMs

- [Video import](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/import.go): `src/internal/video/import.go`
- [GBVP3 encoding](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/gbvp3enc.go): `src/internal/video/gbvp3enc.go`
- [Video fitting](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/fit.go): `src/internal/video/fit.go`
- [Video ROM export](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/video/rom.go): `src/internal/video/rom.go`

### Music ROMs

- [Music ROM export](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/export.go): `src/internal/music/export.go`
- [PCM encoding](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/pcm.go): `src/internal/music/pcm.go`
- [Chiptune encoding](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/music/chiptune.go): `src/internal/music/chiptune.go`

### Tool support

- [FFmpeg wrapper](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/ffmpeg/ffmpeg.go): `src/internal/ffmpeg/ffmpeg.go`
- [GBDK compiler](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/gbdk/compiler.go): `src/internal/gbdk/compiler.go`
- [Dependency manager](https://github.com/ilyashdev/mediaboy/blob/master/src/internal/deps/deps.go): `src/internal/deps/deps.go`

### Other components

- **User**
- **GBDK and FFmpeg**
- **ROM output**

## Connections

- User → App entrypoint: starts (evidence: `src/main.go`)
- App entrypoint → CLI commands: dispatches (evidence: `src/main.go`)
- App entrypoint → Desktop UI: opens (evidence: `src/main.go`)
- User → CLI commands: runs conversion
- User → Desktop UI: selects mode
- Desktop UI → Image conversion: previews image (evidence: `src/internal/ui/app.go`)
- CLI commands → Image conversion: converts image (evidence: `src/internal/cli/commands.go`)
- Image conversion → Image ROM export: prepares assets
- CLI commands → Gallery export: exports gallery
- Image ROM export → Printer support: embeds printer support (evidence: `src/internal/gbdk/encoder.go`)
- CLI commands → Video import: loads clip (evidence: `src/internal/cli/commands.go`)
- Video import → FFmpeg wrapper: uses FFmpeg
- CLI commands → GBVP3 encoding: encodes clip
- CLI commands → Video fitting: fits clip (evidence: `src/internal/cli/commands.go`)
- GBVP3 encoding → Video ROM export: writes video ROM
- CLI commands → Music ROM export: exports playlist
- Music ROM export → PCM encoding: encodes PCM (evidence: `src/internal/music/export.go`)
- Music ROM export → Chiptune encoding: encodes chiptune (evidence: `src/internal/music/export.go`)
- Music ROM export → FFmpeg wrapper: probes audio (evidence: `src/internal/music/export.go`)
- Image ROM export → GBDK compiler: compiles ROM
- Video ROM export → GBDK compiler: compiles ROM
- Music ROM export → GBDK compiler: compiles ROM
- GBDK compiler → GBDK and FFmpeg: invokes toolchain
- Desktop UI → Dependency manager: checks dependencies (evidence: `src/internal/ui/app.go`)
- Dependency manager → GBDK and FFmpeg: installs tools (evidence: `src/internal/deps/deps.go`)
- GBDK compiler → ROM output: writes output
- Video ROM export → ROM output: writes output
- Music ROM export → ROM output: writes output
