# cybermask367/orbisrpc architecture

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

- Interactive diagram: https://gitdiagram.com/cybermask367/orbisrpc
- Repository: https://github.com/cybermask367/orbisrpc

## Overview

orbisRPC is a GoldHEN background daemon that detects the foreground PS4 title, resolves its name and artwork, then publishes a timed Discord Rich Presence over a TLS WebSocket. Its documented resolution stages include local/configured titles, Sony TMDB, pkg-zone homebrew lookup, and retro-game indexes; it also remembers resolved titles and can self-update. The tree includes an installer flow alongside the daemon. Some subsystem links are based on README descriptions and SOURCE INDEX references; unsampled implementations are not assumed to expose further calls.

Main entry points: [`orbisrpc/daemon.c`](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/daemon.c) (Daemon Loop), [`orbisrpc/detect.c`](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/detect.c) (Title Detection), [`installer/installer.c`](https://github.com/cybermask367/orbisrpc/blob/main/installer/installer.c) (Installer Flow), [`orbisrpc/discord.c`](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/discord.c) (Discord Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["Installation"]
  node_installer["Installer Flow<br/>[installer.c]"]
  node_installer_ui["Installer UI<br/>[ui.c]"]
  node_installer_config["Installer Config<br/>[icfg.c]"]
  node_payload_send["Payload Sender<br/>[send.c]"]
end

subgraph group_runtime["Daemon Runtime"]
  node_entry["Payload Entry<br/>[main.c]"]
  node_daemon["Daemon Loop<br/>[daemon.c]"]
  node_config["Runtime Config<br/>[cfg.c]"]
end

subgraph group_resolve["Title Resolution"]
  node_title_detect["Title Detection<br/>[detect.c]"]
  node_title_cache[("Learned Title Cache<br/>[gamecache.c]")]
  node_app_db[("App Database<br/>[appdb.c]")]
  node_tmdb["Sony TMDB<br/>[tmdb.c]"]
  node_pkgzone["Homebrew Lookup<br/>[pkgzone.c]"]
  node_retro["Retro Lookup<br/>[retro.c]"]
  node_art["Artwork<br/>[art.c]"]
end

subgraph group_presence["Presence Delivery"]
  node_discord_client["Discord Client<br/>[discord.c]"]
  node_websocket["WebSocket Transport<br/>[ws.c]"]
  node_tls["TLS Transport<br/>[tls.c]"]
end

subgraph group_operations["Operations"]
  node_updater["Self Updater<br/>[updater.c]"]
  node_health["Health State<br/>[health.h]"]
  node_notifications["Notifications<br/>[notify.c]"]
end

node_user(("PS4 User"))
node_payload["orbisRPC Payload"]
node_discord(("Discord Gateway"))
node_github(("GitHub Releases"))

node_user -->|"installs payload"| node_installer
node_installer -->|"shows dialogs"| node_installer_ui
node_installer -->|"sets token"| node_installer_config
node_installer -.->|"injects payload"| node_payload_send
node_installer -->|"copies payload"| node_payload
node_user -->|"launches payload"| node_payload
node_payload -->|"starts"| node_entry
node_entry -->|"runs daemon"| node_daemon
node_daemon -->|"loads settings"| node_config
node_daemon -->|"polls title"| node_title_detect
node_title_detect -->|"reads and learns"| node_title_cache
node_title_detect -.->|"looks up title"| node_app_db
node_title_detect -->|"resolves Sony IDs"| node_tmdb
node_title_detect -->|"resolves homebrew"| node_pkgzone
node_title_detect -->|"resolves classics"| node_retro
node_title_detect -->|"provides artwork"| node_art
node_daemon -->|"sets presence"| node_discord_client
node_discord_client -->|"uses gateway socket"| node_websocket
node_websocket -->|"secures connection"| node_tls
node_discord_client -->|"sends activity"| node_discord
node_daemon -->|"checks updates"| node_updater
node_updater -->|"fetches releases"| node_github
node_daemon -->|"uses health state"| node_health
node_daemon -->|"announces status"| node_notifications

click node_installer "https://github.com/cybermask367/orbisrpc/blob/main/installer/installer.c"
click node_installer_ui "https://github.com/cybermask367/orbisrpc/blob/main/installer/ui.c"
click node_installer_config "https://github.com/cybermask367/orbisrpc/blob/main/installer/icfg.c"
click node_payload_send "https://github.com/cybermask367/orbisrpc/blob/main/installer/send.c"
click node_entry "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/main.c"
click node_daemon "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/daemon.c"
click node_config "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/cfg.c"
click node_title_detect "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/detect.c"
click node_title_cache "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/gamecache.c"
click node_app_db "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/appdb.c"
click node_tmdb "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/tmdb.c"
click node_pkgzone "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/pkgzone.c"
click node_retro "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/retro.c"
click node_art "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/art.c"
click node_discord_client "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/discord.c"
click node_websocket "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/ws.c"
click node_tls "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/tls.c"
click node_updater "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/updater.c"
click node_health "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/health.h"
click node_notifications "https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/notify.c"

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_installer,node_installer_ui,node_installer_config,node_payload_send,node_user toneBlue
class node_entry,node_daemon,node_config toneAmber
class node_title_detect,node_title_cache,node_app_db,node_tmdb,node_pkgzone,node_retro,node_art toneMint
class node_discord_client,node_websocket,node_tls toneRose
class node_updater,node_health,node_notifications,node_payload,node_discord,node_github toneIndigo
```

## Components

### Installation

- [Installer Flow](https://github.com/cybermask367/orbisrpc/blob/main/installer/installer.c): `installer/installer.c`
- [Installer UI](https://github.com/cybermask367/orbisrpc/blob/main/installer/ui.c): `installer/ui.c`
- [Installer Config](https://github.com/cybermask367/orbisrpc/blob/main/installer/icfg.c): `installer/icfg.c`
- [Payload Sender](https://github.com/cybermask367/orbisrpc/blob/main/installer/send.c): `installer/send.c`

### Daemon Runtime

- [Payload Entry](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/main.c): `orbisrpc/main.c`
- [Daemon Loop](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/daemon.c): `orbisrpc/daemon.c`
- [Runtime Config](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/cfg.c): `orbisrpc/cfg.c`

### Title Resolution

- [Title Detection](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/detect.c): `orbisrpc/detect.c`
- [Learned Title Cache](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/gamecache.c): `orbisrpc/gamecache.c`
- [App Database](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/appdb.c): `orbisrpc/appdb.c`
- [Sony TMDB](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/tmdb.c): `orbisrpc/tmdb.c`
- [Homebrew Lookup](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/pkgzone.c): `orbisrpc/pkgzone.c`
- [Retro Lookup](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/retro.c): `orbisrpc/retro.c`
- [Artwork](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/art.c): `orbisrpc/art.c`

### Presence Delivery

- [Discord Client](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/discord.c): `orbisrpc/discord.c`
- [WebSocket Transport](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/ws.c): `orbisrpc/ws.c`
- [TLS Transport](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/tls.c): `orbisrpc/tls.c`

### Operations

- [Self Updater](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/updater.c): `orbisrpc/updater.c`
- [Health State](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/health.h): `orbisrpc/health.h`
- [Notifications](https://github.com/cybermask367/orbisrpc/blob/main/orbisrpc/notify.c): `orbisrpc/notify.c`

### Other components

- **PS4 User**
- **orbisRPC Payload**
- **Discord Gateway**
- **GitHub Releases**

## Connections

- PS4 User → Installer Flow: installs payload (evidence: `README.md`)
- Installer Flow → Installer UI: shows dialogs (evidence: `installer/installer.c`)
- Installer Flow → Installer Config: sets token (evidence: `installer/installer.c`)
- Installer Flow → Payload Sender: injects payload
- Installer Flow → orbisRPC Payload: copies payload (evidence: `installer/installer.c`)
- PS4 User → orbisRPC Payload: launches payload (evidence: `README.md`)
- orbisRPC Payload → Payload Entry: starts (evidence: `orbisrpc/main.c`)
- Payload Entry → Daemon Loop: runs daemon (evidence: `orbisrpc/main.c`)
- Daemon Loop → Runtime Config: loads settings (evidence: `orbisrpc/daemon.c`)
- Daemon Loop → Title Detection: polls title (evidence: `orbisrpc/daemon.c`)
- Title Detection → Learned Title Cache: reads and learns (evidence: `orbisrpc/detect.c`)
- Title Detection → App Database: looks up title
- Title Detection → Sony TMDB: resolves Sony IDs (evidence: `orbisrpc/detect.c`)
- Title Detection → Homebrew Lookup: resolves homebrew (evidence: `orbisrpc/detect.c`)
- Title Detection → Retro Lookup: resolves classics
- Title Detection → Artwork: provides artwork
- Daemon Loop → Discord Client: sets presence (evidence: `orbisrpc/daemon.c`)
- Discord Client → WebSocket Transport: uses gateway socket (evidence: `orbisrpc/discord.c`)
- WebSocket Transport → TLS Transport: secures connection (evidence: `orbisrpc/ws.c`)
- Discord Client → Discord Gateway: sends activity (evidence: `README.md`)
- Daemon Loop → Self Updater: checks updates (evidence: `orbisrpc/daemon.c`)
- Self Updater → GitHub Releases: fetches releases (evidence: `orbisrpc/updater.c`)
- Daemon Loop → Health State: uses health state (evidence: `orbisrpc/daemon.c`)
- Daemon Loop → Notifications: announces status
