# currentlypending/beatsaberap architecture

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

- Interactive diagram: https://gitdiagram.com/currentlypending/beatsaberap
- Repository: https://github.com/currentlypending/beatsaberap

## Overview

BeatSaberAP is a Beat Saber client mod that gates available songs through an Archipelago session. Players open its menu, enter connection details, connect, and then play unlocked maps; cleared eligible maps report locations, while failures can send DeathLink. The mod also processes .apbs playlist archives and builds an index of available levels. The graph reflects sampled source and README capabilities; some session and progression internals are only partially excerpted, and LockHooks’ apparent gameplay hooks are commented out.

Main entry points: [`Source/Archipelago/APConnection.cs`](https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/APConnection.cs) (Session and item progression), [`Source/Archipelago/ArchipelagoLevelIndex.cs`](https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/ArchipelagoLevelIndex.cs) (Level index), [`Source/BeatSaberAP.cs`](https://github.com/currentlypending/beatsaberap/blob/master/Source/BeatSaberAP.cs) (Plugin lifecycle), [`Source/Hooks/PlaylistFilterHooks.cs`](https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/PlaylistFilterHooks.cs) (Unlocked map filtering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Mod startup"]
  node_plugin["Plugin lifecycle<br/>[BeatSaberAP.cs]"]
  node_installer["Dependency bindings<br/>[InjectInstaller.cs]"]
  node_dispatcher["Main-thread dispatcher"]
end

subgraph group_connection["Archipelago session"]
  node_session["Session and item progression<br/>[APConnection.cs]"]
  node_deathlink["DeathLink handling<br/>[Deathlink.cs]"]
end

subgraph group_levels["Songs and progression"]
  node_levelindex["Level index"]
  node_apbs["Playlist archive handler<br/>[ApbsHandler.cs]"]
  node_playlistfilter["Unlocked map filtering"]
  node_events["Gameplay event hooks<br/>[EventHooks.cs]"]
  node_lockhooks["Campaign lock hooks<br/>[LockHooks.cs]"]
end

subgraph group_interface["Player interface"]
  node_connectionui["Connection settings"]
  node_menu["Menu button"]
  node_flow["Connection screen flow"]
end

node_player(("Player"))
node_apserver(("Archipelago session service"))
node_beatmaps[("Beat Saber levels")]
node_playlistfiles[("Playlist files")]

node_player -->|"opens"| node_menu
node_menu -->|"presents"| node_flow
node_flow -->|"displays"| node_connectionui
node_connectionui -->|"connects"| node_session
node_session -->|"exchanges session data"| node_apserver
node_plugin -->|"installs bindings"| node_installer
node_plugin -->|"initializes"| node_levelindex
node_plugin -->|"creates"| node_dispatcher
node_levelindex -->|"indexes levels"| node_beatmaps
node_levelindex -->|"starts processing"| node_apbs
node_apbs -->|"extracts playlists"| node_playlistfiles
node_playlistfilter -->|"reads level index"| node_levelindex
node_playlistfilter -->|"filters by unlocks"| node_session
node_events -->|"reports completions"| node_session
node_events -->|"checks tracked levels"| node_levelindex
node_session -.->|"supports"| node_deathlink
node_lockhooks -.->|"checks unlocks"| node_session

click node_plugin "https://github.com/currentlypending/beatsaberap/blob/master/Source/BeatSaberAP.cs"
click node_installer "https://github.com/currentlypending/beatsaberap/blob/master/Source/InjectInstaller.cs"
click node_levelindex "https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/ArchipelagoLevelIndex.cs"
click node_apbs "https://github.com/currentlypending/beatsaberap/blob/master/Source/ApbsHandler.cs"
click node_connectionui "https://github.com/currentlypending/beatsaberap/blob/master/Source/UI/ArchipelagoViewController.cs"
click node_menu "https://github.com/currentlypending/beatsaberap/blob/master/Source/UI/MenuButtonManager.cs"
click node_flow "https://github.com/currentlypending/beatsaberap/blob/master/Source/UI/ArchipelagoFlowCoordinator.cs"
click node_session "https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/APConnection.cs"
click node_playlistfilter "https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/PlaylistFilterHooks.cs"
click node_events "https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/EventHooks.cs"
click node_lockhooks "https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/LockHooks.cs"
click node_deathlink "https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/Deathlink.cs"
click node_dispatcher "https://github.com/currentlypending/beatsaberap/blob/master/Source/MainThreadDispatcher.cs"

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_plugin,node_installer,node_dispatcher toneBlue
class node_session,node_deathlink,node_beatmaps,node_playlistfiles toneAmber
class node_levelindex,node_apbs,node_playlistfilter,node_events,node_lockhooks toneMint
class node_connectionui,node_menu,node_flow toneRose
class node_player,node_apserver toneIndigo
```

## Components

### Mod startup

- [Plugin lifecycle](https://github.com/currentlypending/beatsaberap/blob/master/Source/BeatSaberAP.cs): `Source/BeatSaberAP.cs`
- [Dependency bindings](https://github.com/currentlypending/beatsaberap/blob/master/Source/InjectInstaller.cs): `Source/InjectInstaller.cs`
- [Main-thread dispatcher](https://github.com/currentlypending/beatsaberap/blob/master/Source/MainThreadDispatcher.cs): `Source/MainThreadDispatcher.cs`

### Archipelago session

- [Session and item progression](https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/APConnection.cs): `Source/Archipelago/APConnection.cs`
- [DeathLink handling](https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/Deathlink.cs): `Source/Archipelago/Deathlink.cs`

### Songs and progression

- [Level index](https://github.com/currentlypending/beatsaberap/blob/master/Source/Archipelago/ArchipelagoLevelIndex.cs): `Source/Archipelago/ArchipelagoLevelIndex.cs`
- [Playlist archive handler](https://github.com/currentlypending/beatsaberap/blob/master/Source/ApbsHandler.cs): `Source/ApbsHandler.cs`
- [Unlocked map filtering](https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/PlaylistFilterHooks.cs): `Source/Hooks/PlaylistFilterHooks.cs`
- [Gameplay event hooks](https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/EventHooks.cs): `Source/Hooks/EventHooks.cs`
- [Campaign lock hooks](https://github.com/currentlypending/beatsaberap/blob/master/Source/Hooks/LockHooks.cs): `Source/Hooks/LockHooks.cs`

### Player interface

- [Connection settings](https://github.com/currentlypending/beatsaberap/blob/master/Source/UI/ArchipelagoViewController.cs): `Source/UI/ArchipelagoViewController.cs`
- [Menu button](https://github.com/currentlypending/beatsaberap/blob/master/Source/UI/MenuButtonManager.cs): `Source/UI/MenuButtonManager.cs`
- [Connection screen flow](https://github.com/currentlypending/beatsaberap/blob/master/Source/UI/ArchipelagoFlowCoordinator.cs): `Source/UI/ArchipelagoFlowCoordinator.cs`

### Other components

- **Player**
- **Archipelago session service**
- **Beat Saber levels**
- **Playlist files**

## Connections

- Player → Menu button: opens (evidence: `README.md`)
- Menu button → Connection screen flow: presents (evidence: `Source/UI/MenuButtonManager.cs`)
- Connection screen flow → Connection settings: displays (evidence: `Source/UI/ArchipelagoFlowCoordinator.cs`)
- Connection settings → Session and item progression: connects (evidence: `Source/UI/ArchipelagoViewController.cs`)
- Session and item progression → Archipelago session service: exchanges session data (evidence: `Source/Archipelago/APConnection.cs`)
- Plugin lifecycle → Dependency bindings: installs bindings (evidence: `Source/BeatSaberAP.cs`)
- Plugin lifecycle → Level index: initializes (evidence: `Source/BeatSaberAP.cs`)
- Plugin lifecycle → Main-thread dispatcher: creates (evidence: `Source/BeatSaberAP.cs`)
- Level index → Beat Saber levels: indexes levels (evidence: `Source/Archipelago/ArchipelagoLevelIndex.cs`)
- Level index → Playlist archive handler: starts processing (evidence: `Source/Archipelago/ArchipelagoLevelIndex.cs`)
- Playlist archive handler → Playlist files: extracts playlists (evidence: `Source/ApbsHandler.cs`)
- Unlocked map filtering → Level index: reads level index (evidence: `Source/Hooks/PlaylistFilterHooks.cs`)
- Unlocked map filtering → Session and item progression: filters by unlocks (evidence: `Source/Hooks/PlaylistFilterHooks.cs`)
- Gameplay event hooks → Session and item progression: reports completions (evidence: `Source/Hooks/EventHooks.cs`)
- Gameplay event hooks → Level index: checks tracked levels (evidence: `Source/Hooks/EventHooks.cs`)
- Session and item progression → DeathLink handling: supports
- Campaign lock hooks → Session and item progression: checks unlocks
