# nikamimi/dk64rekong-retroachievements architecture

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

- Interactive diagram: https://gitdiagram.com/nikamimi/dk64rekong-retroachievements
- Repository: https://github.com/nikamimi/dk64rekong-retroachievements

## Overview

DK64 RetroAchievements is an in-game RetroAchievements mod. The game-loop hook defers achievement evaluation until gameplay state is updated; the native bridge then evaluates game memory, tracks progress locally or through the online client, and exposes achievement and account data to the in-game browser. The browser supports badge browsing, account actions, and progress reset, with optional badge imagery and unlock audio. The README documents these major features; some implementation wiring is inferred only where the sampled excerpts do not show it, so uncertain links are omitted.

Main entry points: [`native/client_bridge.cpp`](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/client_bridge.cpp) (Client bridge), [`src/ui.c`](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/src/ui.c) (Achievement browser), [`native/probe.cpp`](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/probe.cpp) (Native probe), [`src/mod.c`](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/src/mod.c) (Game-loop hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game Integration"]
  node_mod["Game-loop hook<br/>[mod.c]"]
  node_probe["Native probe<br/>[probe.cpp]"]
end

subgraph group_tracking["Achievement Tracking"]
  node_bridge["Client bridge<br/>[client_bridge.cpp]"]
  node_memory["Game memory<br/>[memory.cpp]"]
  node_ra_client["RA client runtime"]
  node_http["HTTP transport<br/>[http_transport.cpp]"]
  node_awards["Award safety<br/>[online_awards.cpp]"]
  node_catalog["Guest catalog<br/>[guest_catalog.cpp]"]
end

subgraph group_browser["In-Game Browser"]
  node_browser_ui["Achievement browser<br/>[ui.c]"]
  node_browser_input["Browser input<br/>[browser_input.h]"]
  node_browser_rules["Grid navigation<br/>[ra_browser.h]"]
  node_ui_api["UI API<br/>[ra_ui_api.h]"]
end

subgraph group_support["Persistence and Media"]
  node_progress[("Local progress<br/>[local_progress.cpp]")]
  node_badge_cache["Badge cache<br/>[badge_cache.cpp]"]
  node_toast["Unlock notifications<br/>[toast_sound.cpp]"]
end

node_player(("Player"))
node_game(("DK64 runtime"))
node_ra_service(("RetroAchievements"))
node_ui_service["Recomp UI"]
node_media(("RA badge media"))
node_storage[("Local files")]

node_game -->|"fires hooks"| node_mod
node_mod -->|"calls per frame"| node_probe
node_probe -->|"evaluates frame"| node_bridge
node_bridge -->|"reads game state"| node_memory
node_bridge -->|"evaluates achievements"| node_ra_client
node_bridge -->|"dispatches requests"| node_http
node_http -->|"sends HTTPS"| node_ra_service
node_bridge -->|"checks submissions"| node_awards
node_bridge -->|"records local unlocks"| node_progress
node_progress -->|"reads and writes"| node_storage
node_bridge -->|"loads guest catalog"| node_catalog
node_catalog -->|"reads and writes"| node_storage
node_player -->|"provides input"| node_probe
node_probe -->|"captures controls"| node_browser_input
node_browser_input -->|"supplies navigation"| node_browser_ui
node_browser_ui -->|"uses grid logic"| node_browser_rules
node_browser_ui -->|"calls UI imports"| node_ui_api
node_ui_api -->|"renders interface"| node_ui_service
node_browser_ui -->|"requests account and achievement data"| node_bridge
node_bridge -->|"serves badge images"| node_badge_cache
node_badge_cache -.->|"downloads badges"| node_media
node_bridge -->|"plays unlock jingle"| node_toast
node_bridge -->|"provides toast details"| node_browser_ui

click node_mod "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/src/mod.c"
click node_probe "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/probe.cpp"
click node_bridge "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/client_bridge.cpp"
click node_memory "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/memory.cpp"
click node_http "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/http_transport.cpp"
click node_awards "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/online_awards.cpp"
click node_progress "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/local_progress.cpp"
click node_catalog "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/guest_catalog.cpp"
click node_browser_ui "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/src/ui.c"
click node_browser_input "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/browser_input.h"
click node_browser_rules "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/include/ra_browser.h"
click node_ui_api "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/include/ra_ui_api.h"
click node_badge_cache "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/badge_cache.cpp"
click node_toast "https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/toast_sound.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_mod,node_probe,node_ui_service toneBlue
class node_bridge,node_memory,node_ra_client,node_http,node_awards,node_catalog,node_storage toneAmber
class node_browser_ui,node_browser_input,node_browser_rules,node_ui_api toneMint
class node_progress,node_badge_cache,node_toast toneRose
class node_player,node_game,node_ra_service,node_media toneIndigo
```

## Components

### Game Integration

- [Game-loop hook](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/src/mod.c): `src/mod.c`
- [Native probe](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/probe.cpp): `native/probe.cpp`

### Achievement Tracking

- [Client bridge](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/client_bridge.cpp): `native/client_bridge.cpp`
- [Game memory](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/memory.cpp): `native/memory.cpp`
- **RA client runtime**
- [HTTP transport](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/http_transport.cpp): `native/http_transport.cpp`
- [Award safety](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/online_awards.cpp): `native/online_awards.cpp`
- [Guest catalog](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/guest_catalog.cpp): `native/guest_catalog.cpp`

### In-Game Browser

- [Achievement browser](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/src/ui.c): `src/ui.c`
- [Browser input](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/browser_input.h): `native/browser_input.h`
- [Grid navigation](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/include/ra_browser.h): `include/ra_browser.h`
- [UI API](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/include/ra_ui_api.h): `include/ra_ui_api.h`

### Persistence and Media

- [Local progress](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/local_progress.cpp): `native/local_progress.cpp`
- [Badge cache](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/badge_cache.cpp): `native/badge_cache.cpp`
- [Unlock notifications](https://github.com/nikamimi/dk64rekong-retroachievements/blob/main/native/toast_sound.cpp): `native/toast_sound.cpp`

### Other components

- **Player**
- **DK64 runtime**
- **RetroAchievements**
- **Recomp UI**
- **RA badge media**
- **Local files**

## Connections

- DK64 runtime → Game-loop hook: fires hooks
- Game-loop hook → Native probe: calls per frame
- Native probe → Client bridge: evaluates frame
- Client bridge → Game memory: reads game state
- Client bridge → RA client runtime: evaluates achievements
- Client bridge → HTTP transport: dispatches requests
- HTTP transport → RetroAchievements: sends HTTPS
- Client bridge → Award safety: checks submissions
- Client bridge → Local progress: records local unlocks
- Local progress → Local files: reads and writes
- Client bridge → Guest catalog: loads guest catalog
- Guest catalog → Local files: reads and writes
- Player → Native probe: provides input
- Native probe → Browser input: captures controls
- Browser input → Achievement browser: supplies navigation
- Achievement browser → Grid navigation: uses grid logic
- Achievement browser → UI API: calls UI imports
- UI API → Recomp UI: renders interface
- Achievement browser → Client bridge: requests account and achievement data
- Client bridge → Badge cache: serves badge images
- Badge cache → RA badge media: downloads badges
- Client bridge → Unlock notifications: plays unlock jingle
- Client bridge → Achievement browser: provides toast details
